Detecting a closed socket?

BlitzMax Forums/BlitzMax Programming/Detecting a closed socket?

Okay, this is a huge and ugly behemoth. I should, and probably will break this into separate functions - yet at the same time I'm trying to reduce the overhead as much as possible. I'm not sure that this method is faster than calling .ReadAvail() on every socket, but I do know this method works and that it *does* detect closed sockets.

I'm going to put the code in it's own post since it's so large.