As said before and in my opinion, instead of Khaled adding a switch to sockwrite, I think you should not close the socket until you are finished with it.

Another thing I noticed, I dunno, maybe you were testing, but

$bvar(&Read.test,1,$bvar(&Read.test,0)).text

should be the same as: $bvar(&Read.test,1-).text