In Chapter 4, paragraph 4.3 of Steven's "The 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 behind the above statement?
In my own experiments, i wrote a simple tcp client, that would run on host A and a simple tcp server, that would run on host B. The tcp client would attempt to connect to the tcp server on Host B forever.
So, i started the server on host B. Pulled the network wire from the host. Then i started the client on host A. After about 9 unsuccessful connect attempts on the same socket, i simply plugged the network wire back into the server host. The client connected successfully and happily sends messages at 80K/sec.
In yet another experiment, i pulled the wire from the server host, after a initial successful connect and few million messages exchanges after. Then, after few minutes, i connected the wire and message flow resumed on the same socket.