I have a situation where I have multiple threads sending data over a socket. The intended recipients should accept the data, process it, and send it back to the original sender. I have thought of two configs. One where there is just one listening port on the sender side and this port forwards the received data to the thread which shot off the request in the first place. This requires an additional thread_id field to be sent over the network. The second would be that each thread gets its own port for sending and receiving data. This limits the number of simultaneous requests over the net. Is there some other config that I can look into? I am using unix sockets and posix threads using C / C++.
Thanks.