Also, you close the socket via sockread, your sockclose event won't activate because the socket has been closed.
You have to remember this, Dean: > The sockclose event is triggered when a connection is closed by the remote connection (not you).