# How To Reply On TCP in Specified Port?

**URL:** https://discourse.nodered.org/t/how-to-reply-on-tcp-in-specified-port/16715
**Category:** General
**Created:** [15 October 2019 06:09 UTC](https://discourse.nodered.org/t/how-to-reply-on-tcp-in-specified-port/16715 "2019-10-15T06:09:36Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![mrizkywiguna](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mrizkywiguna/32/32016_2.png) [@mrizkywiguna](https://discourse.nodered.org/u/mrizkywiguna)
#### Post date: [15 October 2019 06:09 UTC](https://discourse.nodered.org/t/how-to-reply-on-tcp-in-specified-port/16715/1 "2019-10-15T06:09:37Z")

</div>

Hi All,

I want to send a payload through a different TCP port, now I use TCP Out as the sender of the payload.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/c/c94a308d915556102338696ec72a84f65b9214a8.png)

The problem is that the payload I sent is received by another port.

How do I send the payload according to the port that I specified so it won't be sent to all TCP?

Please Help Me,

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [15 October 2019 09:27 UTC](https://discourse.nodered.org/t/how-to-reply-on-tcp-in-specified-port/16715/2 "2019-10-15T09:27:34Z")

</div>

have you tried using the `Type` `Connect to`?

---

<div class="post-metadata">

### Author: ![mrizkywiguna](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mrizkywiguna/32/32016_2.png) [@mrizkywiguna](https://discourse.nodered.org/u/mrizkywiguna)
#### Post date: [16 October 2019 00:42 UTC](https://discourse.nodered.org/t/how-to-reply-on-tcp-in-specified-port/16715/3 "2019-10-16T00:42:12Z")

</div>

Hi @zenofmud

It's not working. So my payload is command to read modbus with buffer. When i use "reply to TCP", it's working and i can get the modbus value (but problem is the other port received the same command).

```auto
[{"id":"5d62f0e6.6b5028","type":"inject","z":"386a7be.6758384","name":"total delay","topic":"","payload":"","payloadType":"date","repeat":"30","crontab":"","once":true,"onceDelay":0.1,"x":440,"y":1230,"wires":[["9ba50239.468ea"]]},{"id":"9ba50239.468ea","type":"function","z":"386a7be.6758384","name":"VSD Address from 3200 qty:10","func":"msg.payload = Buffer.from('01030C80000AC775', 'hex'); //address for equest Modbus\nreturn msg;","outputs":1,"noerr":0,"x":890,"y":1230,"wires":[["ba564eb.2b94d3"]]},{"id":"ba564eb.2b94d3","type":"tcp out","z":"386a7be.6758384","host":"","port":"","beserver":"reply","base64":false,"end":false,"name":"","x":1390,"y":1230,"wires":[]},{"id":"ea29b5ce.335ed8","type":"tcp in","z":"386a7be.6758384","name":"","server":"server","host":"","port":"1919","datamode":"stream","datatype":"buffer","newline":"","topic":"","base64":false,"x":690,"y":1340,"wires":[["6d366ed5.366668"]]},{"id":"6d366ed5.366668","type":"debug","z":"386a7be.6758384","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":950,"y":1340,"wires":[]}]

```

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/586d42fdc6f5c3527ab7f9ccfd6c9c6e8f1cbca4.png)

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [16 October 2019 09:19 UTC](https://discourse.nodered.org/t/how-to-reply-on-tcp-in-specified-port/16715/4 "2019-10-16T09:19:51Z")

</div>

Hopefully someone else will chime in. I haven't played with the nodes, my suggestion was based on a quick look.

---

<div class="post-metadata">

### Author: ![New2Node](https://avatars.discourse-cdn.com/v4/letter/n/f1d935/32.png) [@New2Node](https://discourse.nodered.org/u/New2Node)
#### Post date: [16 December 2019 16:16 UTC](https://discourse.nodered.org/t/how-to-reply-on-tcp-in-specified-port/16715/5 "2019-12-16T16:16:43Z")

</div>

Did you resolve this issue? I also have the same issue where I send data simultaneously on ports 2000 & 2001 but the responses get mixed up across nodes.

---

<div class="post-metadata">

### Author: ![PiMo131](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pimo131/32/34978_2.png) [@PiMo131](https://discourse.nodered.org/u/PiMo131)
#### Post date: [17 January 2021 14:06 UTC](https://discourse.nodered.org/t/how-to-reply-on-tcp-in-specified-port/16715/6 "2021-01-17T14:06:12Z")

</div>

@New2Node and @mrizkywiguna Did you resolve this issue? I am running in to the same problem..
