Suppose you connected to a server through socket connection and for onetime you send the request to the server and receive the response then again you try to send the request to the server but send(); returns -1 because server was down after a while server comes up,can you use the same socket to send request to the server ?
Suppose you connected to a server through socket connection and for onetime you send
Share
No, when you get the error the connection is no longer valid. Once a connection is invalidated, you should just close the socket; you can’t reuse it for a new connection. If the server has gone down, it has no memory of the parameters of the original connection (e.g. port numbers); you need to open a new connection so that the client and server will be in sync.