Establish a TCP server on the red node, how to send information to the client, and use the echo method will cause other ports to be polluted.
Have you looked at the tcp-in/-out nodes? They do exactly that.
Not clear what you mean by that. You can inject data before the tcp-out node.
Using the tcp-to method to establish a server can transmit information to the client, but how to obtain the information sent by the client to the server.
If the server is established in the in-tcp mode, the information sent by the client can be obtained, but the server can only use the to-tcp response tcp to send information to the client, which will cause the information to be sent on other ports synchronously. . Moreover, in-tcp and to-tcp cannot establish a server with the same port at the same time, and can only use the method of responding to tcp.
That is available as the output from the tcp-in node, simply feed that output to your flow.
That will always be the case for any server since you can only ever have a single address:port combination. To set up a tcp "server" you need a pair of in/out nodes but the out node can also be used separately if you want to connect to another tcp server.
You might also be able to use a reverse proxy such as NGINX to help. It can proxy and load balance TCP services. This may work for you depending on what you are actually trying to achieve.
If the remote client maintains the tcp connection, you should be able to continue to send data via the paired out node. Similarly, a new connection can trigger other information to be added to the return as long as you respond within a reasonable time.