Hi!
I'm programming an application which change , first, from server to client, and then comes back to server.
I'm using the TCPSocket library, and in the last change (commming back from client to server) I´ve got a bind error.
The sequence is the next:
1) SERVER: I bind the socket with "IP" and "port" and listen waiting for the connection. I accept the communication, and I create a new socket for the interchange of information, handling the events on this socket.
Now I want to be a client.
2)CLIENT: I close the two sockets I was unsing on the SERVER mode, and I open a new one, and connect it with "IP2" and "port2".
Now I want to be a server again.
3)SERVER: I close the socket I was using on the CLIENT MODE, and I do the same that in step 1). I want to use the same IP and port, but I´m not sure if I can.
My doubt is if after closing a server socket, is possible to open it again with the same IP and port.
Can anybody help me?
Thanks!!
Hi! I'm programming an application which change , first, from server to client, and then comes back to server. I'm using the TCPSocket library, and in the last change (commming back from client to server) I´ve got a bind error. The sequence is the next: 1) SERVER: I bind the socket with "IP" and "port" and listen waiting for the connection. I accept the communication, and I create a new socket for the interchange of information, handling the events on this socket.
Now I want to be a client.
2)CLIENT: I close the two sockets I was unsing on the SERVER mode, and I open a new one, and connect it with "IP2" and "port2".
Now I want to be a server again.
3)SERVER: I close the socket I was using on the CLIENT MODE, and I do the same that in step 1). I want to use the same IP and port, but I´m not sure if I can.
My doubt is if after closing a server socket, is possible to open it again with the same IP and port.
Can anybody help me? Thanks!!