Using same port for Server and Client

Is it possible to use same port for both the server and client. that is what i mean is if a client connects to the server at port 2332 then server will randomly assign an port, using this port server and client will communicate with each other. Hear, wht i need is i want that randomly assigned port also to same as listen port.

Basically i need this for NAT implementation


Answer this question

Using same port for Server and Client

  • Bojo

    You can bind the client to use a fixed port via the Winsock bind() call prior to connecting, assuming no other process is currently using that port on the system.



  • Using same port for Server and Client