Reconnecting with connect() on restarted server returns -Transport endpoint is already connected

后端 未结 1 362
小鲜肉
小鲜肉 2021-01-22 17:47

Okay, I\'ve read this post in search for the right answer, but it does not seem to serve my purpose.

This Question

Now, getting to the trouble:

I have a

1条回答
  •  心在旅途
    2021-01-22 18:16

    sockets cannot be reused.

    Once the connection a socket served has gone down in both directions, the socket is unusable.

    close() the client socket on loss of connection and create a new socket for a new connection.


    Update (based on the comments below):

    In the OP's case one side (the server side) went down (by means of the server process ending). This implies all sockets held by this process are implicitly close()ed and therefore shutdown() in both directions.

    0 讨论(0)
提交回复
热议问题