When calling Socket.Select with lists that are verified to contain only Socket objects, I sometimes receive the error An operation was attempted on something that is not a socket
. I can't find a pattern for occurrence.
Socket.Select(readList, writeList, null, timeOut > 0 ? timeOut : 0);
It turns out the sockets were closed. That's a really dumb error for .NET to be generating though just because of a closed socket.
I did a search on MSDN and got a couple of hits. See here & here
However, I haven't develop anything in WinSock but on Unix the way Select
is implemented requires resetting the fd_set
everytime Select
returns. Maybe the same applies to WinSock implementation of Select also. If this is the case, your readList, writeList
may have got corrupted after Select
returned leading to the error you mentioned. Just a thought.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With