Original Post
Using windows socket code, is there any way to detect a dead socket in a proactive way? You can always do the if(socket times out on write) { socket dead } This only works when you have to write. You can't detect a dead socket if you are reading, unless you know you are suposed to read data. I know you can also use the keepalive option, but that only works if the server supports it (server in one case is a microcontroller, which doesn't). Is there any other way to do this without doing a write? Can you send like a zero length packet and get back an ACK and tell that way? Is there some obscure function for windows sockets that lets you do this? Or do I have to hack some kind of pseudo keep alive using an echo type packet that is sent every time period I'm interested in? Current problem I am having is that if a socket is dead due to the server reseting or the physical connection being severed (which can happen due to outside circumstances) it takes a couple of writes to detect that things aren't working. The really bad part about this, is that different systems seem to require a different number of writes. Anyone got any ideas?