I am building a network client style interface where the server will be on or off at various times. I am working on the outer connection look where I attempt to connect and if the connect times out I retry the connection. I have set the timeout for send and receive for the socket. When the connect times out, I do some small amout of housekeeping then try the connection again. The problem is I have to wait a very large amount of time before I can retry the connection without getting a socket EINPROGRESS status. This delay is on order of seconds.
If I don't delay the task and keep asking for a connection the connection continues to return EINPROGRESS status and never connects. Is there a way to check the status of the socket to know when I can ask if it is ready? Is there a known timeout value that I have to wait until I ask for another connection?
Is this the expected behaviour?
I don't think so, but I will have to check the code to know for sure.
I will assume that how the code works is correct and will see if I can figure out what I am dong wrong.