In chapter 4, paragraph 4.3 of Stephen's "Socket: Networking API, Third Edition", the author states the following
"If connect fails, the socket is no longer usable and must be closed. We cannot call connect again on the socket."
Does anyone know the reason for the above statement?
In my own experiments, I wrote a simple tcp client that will run on host A and on a simple tcp server that will run on host B. The tcp client will try to connect to the tcp server on host B forever.
So, I started the server on host B. I pulled the network cable from the host. Then I started the client on host A. After 9 unsuccessful attempts to connect to the same socket, I just connected the network wire back to the server. The client successfully and successfully sends messages at a speed of 80 fps.
In another experiment, I pulled a wire from the server host after a successful successful connection and the exchange of several million messages. Then, after a few minutes, I connected the wire and message flow resumed in the same slot.
source share