Reputation: 751
The question is the title. But I'd like to describe my problem so that someone can suggest an alternative solution. I know that when the client sends a message on a socket to 12.34.56.78:40, the router on the client's side sets a rule for some time that any data received from the 12.34.56.78:40 is allowed and will be sent to the client machine on the network. so the problem I have is that the client is sending to the server on some port but the server needs to reply using a different socket (thus a different port). but ofcourse the server's ip didnt change. so that was my first idea of solving the problem spoof the outgoing port
Upvotes: 1
Views: 572
Reputation: 488
Multiple sockets can bind to the same port, and thus send packets with the same source port number, if the each socket sets the SO_REUSEPORT socket option. See the SO_REUSEPORT socket option and the difference between SO_REUSEADDR and SO_REUSEPORT.
Upvotes: 1