Is there anyway to bind a port to one process and send data to a different port? Currently, I have a server and client process that communicate on the same port through UDP. This works fine when the processes are on different machines, but now that I no longer have a lab to use for testing, I’d like to be able to run the server and the client on the same machine, without altering how they communicate (that is, continue to create datagrams and send them with UDP). This doesn’t work without altering anything, because once the server binds to the port, the client cannot.
What I’m looking for is something like this. The server binds to port 1 and the client binds to port 2. The server listens for traffic on port 1 but sends traffic to port 2, while the client listens on port 2 and sends to port 1. (If other clients join, they would do the same as the first client) Is it possible to specify the port of the destination?
Upon further investigation it looks like it is. I’ll keep this thread incase others have the same question and post the solution.