WinSock API: recv(SOCKET thesock, char *buf, int len, int flags)

buf is a pointer to your "local per-socket buffer", which is filled up to len, which builds your "recieve queue" your recieve queue is iterated for cr, lf, or crlf with use of -n.

from position 1 to position <cr,lf,or crlf> is copied onto your binvar (which I'm treating as a globally allocated character array, under assumption, especially since the recieve buffer is already a pointer to a character array, be it iterate and set, memcp, etc... it's just speculation, only khaled knows) much like echoing the array utilizing $bfind() such as

echo -a $bvar(&var,$+(1-,$bfind(&var,1,13)))

the result will have $chr(13) in it, much like what's happening. You did in fact recieve bytes, two of them, 13 and 10.

"The result of the current situation is that the script gets bytes that were not received on the socket."

Albiet these are now 0, instead of 13 and 10, this is answered by the replacement of those characters with "\0" so $bvar(&var,x-).text for the "string" much like using sprintf, wsprintf, cout, etc.. will terminate upon the first found ascii code 0.