Some sockets questions
Dave Higton (1515) 3534 posts |
I’ve got an app that communicates over Ethernet with a small piece of embedded stuff. I’m having another look at making my app more robust in the face of communications failures. Barring programming errors, sockets exhaustion and OS failure, what other reasons are there why a call to create a stream socket might fail? Having created a socket, the next step is to bind it to the local address and ‘any’ port (0). What reasons are there why this might fail? Having created and bound it, is there any reason why setting it non-blocking might fail? |
Dave Higton (1515) 3534 posts |
Still hoping for answers to the above… I have another question. I’m using XSocket_Send to send data on a non-blocking, connected TCP socket (it’s a 200 OK reply), and immediately after the call to send I’m shutting the socket down using Socket_Shutdown, sock%, 2. Sometimes the 200 OK response isn’t noticed at the other end, which makes me wonder if I’ve closed the socket before the data have actually gone. I’m not asking to know if the data have been delivered (I know that can’t be done), but is there a way to know if data have been sent, i.e. left the machine? |