Hi All,
I wrote a flow that requires me to send multiple tcp requests (because i need a different source port for each request).
For example, I have attached a flow that simulates what I need (not my own).
In the attached flow, you will see two TPC request nodes, but in my flow, I will not know how many TCP requests I will need to send.
The number may be 3, or 100, so I can't put a fixed node of TCP request.
In addition, in my flow the server side will be out of the node-red.
I would appreciate some assistance with this issue.
Node-RED version: v2.0.5
Node.js version: v14.16.1
[{"id":"fd6b4ec4ec65ba97","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"94b9a9fa27c8ba18","type":"tcp in","z":"fd6b4ec4ec65ba97","name":"","server":"server","host":"","port":"230","datamode":"stream","datatype":"buffer","newline":"","topic":"","base64":false,"x":190,"y":380,"wires":[["426a7c1866b113fc","a78e5b92d3a63ed3"]]},{"id":"9b2685d01514d819","type":"tcp request","z":"fd6b4ec4ec65ba97","server":"localhost","port":"230","out":"sit","splitc":" ","name":"","x":450,"y":140,"wires":[["900e21e0716caa6a"]]},{"id":"bcc1f4e097dc02a3","type":"inject","z":"fd6b4ec4ec65ba97","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[49,50,51]","payloadType":"bin","x":190,"y":120,"wires":[["9b2685d01514d819"]]},{"id":"8fd1844d1d984120","type":"debug","z":"fd6b4ec4ec65ba97","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":590,"y":380,"wires":[]},{"id":"8daf933281d13657","type":"inject","z":"fd6b4ec4ec65ba97","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[50,51,52,53,54,55]","payloadType":"bin","x":190,"y":160,"wires":[["9b2685d01514d819"]]},{"id":"be2cfbe0a52200b9","type":"tcp request","z":"fd6b4ec4ec65ba97","server":"localhost","port":"230","out":"sit","splitc":" ","name":"","x":450,"y":220,"wires":[["900e21e0716caa6a"]]},{"id":"9a30bffe493dd97d","type":"inject","z":"fd6b4ec4ec65ba97","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[97,98,118,102,102,100]","payloadType":"bin","x":190,"y":220,"wires":[["be2cfbe0a52200b9"]]},{"id":"5ac5c5c72696ca49","type":"tcp out","z":"fd6b4ec4ec65ba97","host":"","port":"","beserver":"reply","base64":false,"end":false,"name":"","x":690,"y":460,"wires":[]},{"id":"2443e5a47c870746","type":"function","z":"fd6b4ec4ec65ba97","name":"","func":"msg.payload[0] = 7;\nconsole.log(\"payload\"+JSON.stringify(msg));\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":530,"y":460,"wires":[["5ac5c5c72696ca49"]]},{"id":"426a7c1866b113fc","type":"delay","z":"fd6b4ec4ec65ba97","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"x":370,"y":460,"wires":[["2443e5a47c870746"]]},{"id":"c0454b5e2f0c4cd7","type":"debug","z":"fd6b4ec4ec65ba97","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":850,"y":180,"wires":[]},{"id":"a78e5b92d3a63ed3","type":"function","z":"fd6b4ec4ec65ba97","name":"Request print","func":"console.log(\"Request\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":390,"y":380,"wires":[["8fd1844d1d984120"]]},{"id":"900e21e0716caa6a","type":"function","z":"fd6b4ec4ec65ba97","name":"Response print","func":"console.log(\"Response\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":650,"y":180,"wires":[["c0454b5e2f0c4cd7"]]},{"id":"649b8a2da645ceb8","type":"comment","z":"fd6b4ec4ec65ba97","name":"Server","info":"","x":190,"y":320,"wires":[]},{"id":"14e92ddbacbe33e1","type":"comment","z":"fd6b4ec4ec65ba97","name":"Client","info":"","x":190,"y":80,"wires":[]}]
Thanks for your help!