Red Squirrel
No Lifer
I've been working on a socket class for writing server apps. I've had it for a while but been adding more to it and making it more bullet proof.
I ran into an issue, and that's when a client is disconnected abnormally (ex: unplug network cable) my class can't detect it. I tried with both send and recv then checking errno, nothing changes, at all. This is TCP, so to me there should be some kind of lower level signal of some sort that indicates error, but aparantly not.
This leaves any server app I write susceptible to a sort of DDoS attack where one could simply keep connecting but killing the connection abnormally. (I'm sure there must be a way to simulate an unplugged cable at client's end, and do this very fast). Over time the server would have so many clients "open" it would run out of memory. I need a way to scan though client connections and detect if it's lost contact with the client.
Now, some protocols have their own system for this such as sending keep alives, but I want to detect this at a lower level, so I don't have to depend on the application protocol to have this. Not all protocols may have this so if I write a server app for such protocol, I want it to work properly.
I ran into an issue, and that's when a client is disconnected abnormally (ex: unplug network cable) my class can't detect it. I tried with both send and recv then checking errno, nothing changes, at all. This is TCP, so to me there should be some kind of lower level signal of some sort that indicates error, but aparantly not.
This leaves any server app I write susceptible to a sort of DDoS attack where one could simply keep connecting but killing the connection abnormally. (I'm sure there must be a way to simulate an unplugged cable at client's end, and do this very fast). Over time the server would have so many clients "open" it would run out of memory. I need a way to scan though client connections and detect if it's lost contact with the client.
Now, some protocols have their own system for this such as sending keep alives, but I want to detect this at a lower level, so I don't have to depend on the application protocol to have this. Not all protocols may have this so if I write a server app for such protocol, I want it to work properly.