|Posted by Andrea Fontana|
in reply to frame
On Sunday, 15 May 2022 at 06:37:08 UTC, frame wrote:
On Saturday, 14 May 2022 at 23:23:47 UTC, Andrea Fontana wrote:
Which kind of socket exception could be triggered by a client?
It doesn't matter if triggered by a client or not, you need to deal with the possibility. A closed/destroyed socket is an invalid resource.
I recently had the scenario on Windows where a client crashed and the socket wasn't closed properly somehow. Now the server adds the socket to the set to see an update - boom! "Socket operation on non-socket" error.
Also accepting sockets can throw, for eg. by a stupid network time out error - not only on Windows. Other socket operations are no exceptions either.
isAlive is fine for properly shutdowned/closed sockets by you or peer. But it doesn't protect you from faulting ones.
Ok, added some checks on .select, .accept, .bind, .listen.