WinSock client ports and router port forwarding
I have a 开发者_开发问答server application that binds to a port and listens on it. I've set up the router to forward the data on this port to the server.
Now, on the client side, I don't actually bind() the socket to any port, and I usually end up with a different port everytime. In that case, how can I prepare the router to forward that port to the client? Or am I supposed to use bind() with the client socket as well? (I remember reading that you're not supposed to do that.)
Firewalls are usually stateful - meaning if TCP connection request into the protected network is allowed, then the packets back to the client are matched (and passed through) automatically. That is to say you don't worry about the client, just setup port forwarding to the server app.
精彩评论