# Tcpin, status and \_session

**URL:** <https://discourse.nodered.org/t/tcpin-status-and-session/24820>\
**Category:** General\
**Created:** [14 April 2020 15:10 UTC](https://discourse.nodered.org/t/tcpin-status-and-session/24820 "2020-04-14T15:10:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Corhondor](https://avatars.discourse-cdn.com/v4/letter/c/7ab992/32.png) [@Corhondor](https://discourse.nodered.org/u/Corhondor)\
**Post date:** [14 April 2020 15:10 UTC](https://discourse.nodered.org/t/tcpin-status-and-session/24820/1 "2020-04-14T15:10:13Z")

</div>

Hello, I'm trying to use multiple tcp connections in the same flow. Sometimes I send the first message to the tcp connection so I need to know the \_session ID of each connection to avoid send the message to all the connections. I read in this post --\> [https://discourse.nodered.org/t/tcp-flow-almost-got-it-working/9274](https://discourse.nodered.org/t/tcp-flow-almost-got-it-working/9274) that I can use the status message to get the ID of the connection, but it dosn't work.  
Looking into the code, in the file 31-tcpin.js y made this change and now it's works fine (line 78)

var setupTcpClient = function() {  
node.log(RED._("tcpin.status.connecting",{host:node.host,port:node.port}));  
node.status({fill:"grey",shape:"dot",text:"common.status.connecting"});  
var id = (1+Math.random()\*4294967295).toString(16);  
client = net.connect(node.port, node.host, function() {  
buffer = (node.datatype == 'buffer') ? Buffer.alloc(0) : "";  
node.connected = true;  
node.log(RED._("tcpin.status.connected",{host:node.host,port:node.port}));  
node.status({fill:"green",shape:"dot",text:"common.status.connected"});  
**node.status({\_session:id}); //This line is mine**  
});  
client.setKeepAlive(true,120000);  
connectionPool[id] = client;

Is it a bug or did I misunderstand the post? If it's a bug, how can I solve permantly (after an update, for example)? If not a bug, what is the correct way to do it?

Regards

---

<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:** [13 June 2020 15:10 UTC](https://discourse.nodered.org/t/tcpin-status-and-session/24820/2 "2020-06-13T15:10:14Z")

</div>

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