you should check how much info is currently queued by using $sock().sq (send queue) before trying to queue info on a socket. somthing like this
if ($sock($sockname).sq < 16000) { sockwrite bla bla }
or maby
if ($sock($sockname).sq > 16000) { return }
becuse the maximum info can be queued is 16384
also you sould wait while there is still info queued in the send buffer before using the sockwrite command again