# TCP Request Node Manual Disconnect

**URL:** <https://discourse.nodered.org/t/tcp-request-node-manual-disconnect/21372>\
**Category:** General\
**Created:** [6 February 2020 21:07 UTC](https://discourse.nodered.org/t/tcp-request-node-manual-disconnect/21372 "2020-02-06T21:07:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![martynwendon](https://avatars.discourse-cdn.com/v4/letter/m/b5a626/32.png) [@martynwendon](https://discourse.nodered.org/u/martynwendon)\
**Post date:** [6 February 2020 21:07 UTC](https://discourse.nodered.org/t/tcp-request-node-manual-disconnect/21372/1 "2020-02-06T21:07:48Z")

</div>

Is it possible to disconnect a TCP Request Node that has been configured with "never - keep connection open"?

I'm trying to connect on-demand to a remote client and transfer / receive data within that session, then finally disconnect once finished.

Looking at the source for the TCP Request Node it looks like I can set the node with "never - keep connection open" and it then looks like I can connect on-demand, send a message and receive an initial reply, then poke the input again on the TCP Request Node to carry on the conversation back and forth as needed on the existing connection.

Is my understanding of that correct?

What I seem to be missing though is a way to disconnect when finished?

Is that possible?

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![guitarpicva](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/guitarpicva/32/17069_2.png) [@guitarpicva](https://discourse.nodered.org/u/guitarpicva)\
**Post date:** [18 February 2020 18:15 UTC](https://discourse.nodered.org/t/tcp-request-node-manual-disconnect/21372/2 "2020-02-18T18:15:14Z")

</div>

If you are trying to do something "LIKE" a telnet session the answer is "Yes". You can carry on a back and forth "session" say of ascii text commands and responses will be offered on receive.

The issue I have thus far is that I cannot seem to find the right combination of messages and such to dynamically set the IP addres, the port and the "open status". I prefer to keep the connection open at all times, and it seems that if one sets the IP address and port by using msg.host and msg.port, it will NOT stay open even if the node is configured that way. It is a real short-coming to NOT be able to open a socket with dynamically derived parameters (global context for instance), and then have the socket stay open.

---

<div class="post-metadata">

**Author:** ![guitarpicva](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/guitarpicva/32/17069_2.png) [@guitarpicva](https://discourse.nodered.org/u/guitarpicva)\
**Post date:** [18 February 2020 18:23 UTC](https://discourse.nodered.org/t/tcp-request-node-manual-disconnect/21372/3 "2020-02-18T18:23:07Z")

</div>

I have seen a flow that forced a TCP request node disconnect by sending it an invalid TCP port along with the IP address. That seemed to work ok when I tested it with an inject node.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [18 April 2020 18:30 UTC](https://discourse.nodered.org/t/tcp-request-node-manual-disconnect/21372/4 "2020-04-18T18:30:45Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
