"Alex Black"
Is there a good way to do this?
My server is a basic HTTP server, and if the client has disconnected while I'm still processing their request I'd like to abort the processing (e.g. no point doing work if the client is not there waiting for the data).
If the client closes the connection cleanly, you will get an end-of-file if you try to read from the socket. You should be able to get a notification of that if you have an asynchronous read outstanding. If the client just disappears, you won't get any notification until you try to send data (including the OS sending TCP Keepalives, if they are enabled); then when that data send times out, you will get an error, probably on your read or the next time you try to write.
I've read I can try to read from the socket, but in HTTP the client sends the request, and doesn't write any more to the socket.
You can still try to do an asynchronous read from the socket; it will just never fire the event as long as there is no data to read. Hope this helps, ----Scott.