# Single TCP client with send/receive

**URL:** https://discourse.nodered.org/t/single-tcp-client-with-send-receive/847
**Category:** General
**Created:** [16 June 2018 03:45 UTC](https://discourse.nodered.org/t/single-tcp-client-with-send-receive/847 "2018-06-16T03:45:50Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![mlschuh](https://avatars.discourse-cdn.com/v4/letter/m/ce73a5/32.png) [@mlschuh](https://discourse.nodered.org/u/mlschuh)
#### Post date: [16 June 2018 03:45 UTC](https://discourse.nodered.org/t/single-tcp-client-with-send-receive/847/1 "2018-06-16T03:45:50Z")

</div>

Hi there,

I’m attempting to use the TCP nodes in a fairly mundane manner. I have a TCP server on an external device. I would like to connect to it, send it a message, be able to get the response, send another message, etc. Essentially it’s a telnet server that requires login and therefore I need the sender and receiver TCP nodes to use the same TCP socket otherwise you cannot authenticate. The endpoint device does not send an initial message on connection. Can I do that with the existing TCP nodes?

-Mitch

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [16 June 2018 05:25 UTC](https://discourse.nodered.org/t/single-tcp-client-with-send-receive/847/2 "2018-06-16T05:25:15Z")

</div>

Look at the TCP-request node rather than the in and out ones

---

<div class="post-metadata">

### Author: ![mlschuh](https://avatars.discourse-cdn.com/v4/letter/m/ce73a5/32.png) [@mlschuh](https://discourse.nodered.org/u/mlschuh)
#### Post date: [16 June 2018 15:26 UTC](https://discourse.nodered.org/t/single-tcp-client-with-send-receive/847/3 "2018-06-16T15:26:54Z")

</div>

The request node looks to close the connection after every request. This causes the auth to reset so I can’t maintain the same session. Unless I’m doing something wrong with the settings?

---

<div class="post-metadata">

### Author: ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)
#### Post date: [16 June 2018 15:55 UTC](https://discourse.nodered.org/t/single-tcp-client-with-send-receive/847/4 "2018-06-16T15:55:09Z")

</div>

Have you tried setting Return to `never - keep connection open` ?

---

<div class="post-metadata">

### Author: ![mlschuh](https://avatars.discourse-cdn.com/v4/letter/m/ce73a5/32.png) [@mlschuh](https://discourse.nodered.org/u/mlschuh)
#### Post date: [25 June 2018 22:19 UTC](https://discourse.nodered.org/t/single-tcp-client-with-send-receive/847/5 "2018-06-25T22:19:59Z")

</div>

It looks like the `never - keep connection open` is what I’m looking for. The name mislead me as I assumed `never` would be never give me a return value, not never close the connection.
