You should check for errors in a sockopen event, yes. There's no need in on sockread, since an error on an active socket will result in the socket closing. $sockerr should never be anything other than 0 in the sockread event as far as I know.

Edit: I see what you mean now. If you don't understand what the different winsock errors mean then that won't really help you, so it depends how knowledgeable you are really.