sock_stream based connect()
I have written a tcp client program and in nonblocking mode, it tries to connect to array of address sequentially, here if the connect() to first host fails(timeout,refused, etc) then the socket is shutdown and the subsequent connects() to different address fails and we see EINVAL.
the manpage of connect() says when you get EINVAL when it socket is shutdown.
so, my questions are
a. is the behavior correct and is it what expected.
b. you can have multiple connects datagram sockets but why not in TCP?
c. this behavior is not seen in blocking mode
d. when the socket is marked as shutdown, is there a way to make it up? so, if not possible then creating a new socket is the only way?
Pl let me know