c++ - tcp socket, cannot bind to port - in use -
ive got c++ program acts server (sends/receives). i'm trying connect port server using (say 2222). however, message i'm getting port bound to. port in use. i'm wondering how can connect open port (bearing in mind c++ tcp program closed source)? can change source of c++ program if needed, seems strange cannot connect port it's using. wonder need implement threading in tcp program, send , receive's using different port?
there 2 ports involved in tcp connection. incoming port server listening on , outgoing port client connecting on.
they don't need same port.
if both client , server running on same machine, can't same port because port in use (by server, presumably).
if that's case, bind client socket port 0 instead, says "give me available port".
Comments
Post a Comment