# TCP Out node closes all connections when a client disconnects

**URL:** <https://discourse.nodered.org/t/tcp-out-node-closes-all-connections-when-a-client-disconnects/65042>\
**Category:** General\
**Created:** [13 July 2022 10:11 UTC](https://discourse.nodered.org/t/tcp-out-node-closes-all-connections-when-a-client-disconnects/65042 "2022-07-13T10:11:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![polrodoreda](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@polrodoreda](https://discourse.nodered.org/u/polrodoreda)\
**Post date:** [13 July 2022 10:11 UTC](https://discourse.nodered.org/t/tcp-out-node-closes-all-connections-when-a-client-disconnects/65042/1 "2022-07-13T10:11:18Z")

</div>

A **TCP out node** closses all the connections at once when a client disconnects.  
Is this a bug from the node?

Is there any way to solve this issue?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [13 July 2022 12:56 UTC](https://discourse.nodered.org/t/tcp-out-node-closes-all-connections-when-a-client-disconnects/65042/2 "2022-07-13T12:56:35Z")

</div>

I suspect this is related to a known bug (fixed in src).

> <https://github.com/node-red/node-red/issues/3619>
>
> \### Current Behavior
> 
> TCP out node in listening mode not working properly, if …a client disconnects unexpectedly, it throws a socket error and some of the still active clients stop receiving data.
> 
> \### Expected Behavior
> 
> 1:Configure a tcp-out node in listen mode (in my example, write timestamp every 1 seconds)
> 2:Connect with multiple clients ( putty, telnet, localhost in my case, but i tested also from multiple external clients)
> 3:Kill a terminal from task manager or plug off the ethernet from a remote client
> 4:The rest of the clients still receiving the data
> 
> \### Steps To Reproduce
> 
> 1:Configure a tcp-out node in listen mode (in my example, write timestamp every 1 seconds)
> 2:Connect with multiple clients ( putty, telnet, localhost in my case, but i tested also from multiple external clients)
> 3:Kill a terminal from task manager or plug off the ethernet from a remote client
> 4:The node red console writes socket error, the other clients randomly stops receiving data
> 
> \### Example flow
> \`\`\`json
> \[
> {
> "id": "69b8f80db494f181",
> "type": "tcp out",
> "z": "360d032be0511281",
> "name": "",
> "host": "",
> "port": "50000",
> "beserver": "server",
> "base64": false,
> "end": false,
> "tls": "",
> "x": 520,
> "y": 120,
> "wires": \[\]
> },
> {
> "id": "d8083637a25dd4a4",
> "type": "trigger",
> "z": "360d032be0511281",
> "name": "",
> "op1": "",
> "op2": "0",
> "op1type": "date",
> "op2type": "str",
> "duration": "-250",
> "extend": false,
> "overrideDelay": false,
> "units": "ms",
> "reset": "",
> "bytopic": "all",
> "topic": "topic",
> "outputs": 1,
> "x": 280,
> "y": 120,
> "wires": \[
> \[
> "69b8f80db494f181"
> \]
> \]
> },
> {
> "id": "50c6bd3df2d0fe6e",
> "type": "inject",
> "z": "360d032be0511281",
> "name": "",
> "props": \[
> {
> "p": "payload"
> },
> {
> "p": "topic",
> "vt": "str"
> }
> \],
> "repeat": "",
> "crontab": "",
> "once": false,
> "onceDelay": 0.1,
> "topic": "",
> "payload": "",
> "payloadType": "date",
> "x": 140,
> "y": 40,
> "wires": \[
> \[
> "d8083637a25dd4a4"
> \]
> \]
> }
> \]
> \`\`\`
> 
> \### Environment
> 
> \- Node-RED version:
> \- Node.js version:
> \- npm version:
> \- Platform/OS:
> \- Browser:

> [@polrodoreda](#):
>
> Is there any way to solve this issue?

- Wait for the v3 release (hopefully being announced this week)
- Run node-red from source (github `master` branch)
- Run the beta.4 (with a few known issues)
- Hack your installation (replace your current `31-tcpin.js` file with [this one](https://github.com/node-red/node-red/blob/master/packages/node_modules/@node-red/nodes/core/network/31-tcpin.js)

---

<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:** [11 September 2022 12:57 UTC](https://discourse.nodered.org/t/tcp-out-node-closes-all-connections-when-a-client-disconnects/65042/3 "2022-09-11T12:57:29Z")

</div>

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