Hi guys,
when trying to receive a file, I have the following problem with Microsoft's
winsock communications.
Sending a string containing CHR(0) the received string is truncated after
CHR(0).
For example, sending:
"123" + CHR(0) + "456"
I receive only: RxString = "123"
while I see that bytesTotal=7
By using:
Winsock.getData RxString, vbSTRING
things are worse because when just received the first CHR(0) the getData cannot
receive any other string:
for example sending another: "123456"
I receive a NULL RxString = ""
(while I see that bytesTotal are right = 6)
By using:
Winsock.getData RxString, (vbBYTE+vbARRAY)
things are a little better because sending:
"123" + CHR(0) + "456"
I receive the same truncated string:
RxString = "123"
(while I see that bytesTotal=7)
but, this time, the next communication are not truncated:
for example sending again "123456"
I receive RxString = "123456"
(and I see that bytesTotal=6)
I think something is wrong in my reading routine:
Sub winsock_DataArrival(ByVal bytesTotal)
Dim RxStringByte
Dim RxString
Winsock.getData RxStringByte, (vbBYTE+vbARRAY)
For i = 0 To bytesTotal-1
RxString = RxString + ChrW(RxStringByte(i))
Next
Print bytesTotal, RxString
End Sub
I've tried also ChrB(RxStringByte(i)) and Chr(RxStringByte(i)) but things are
even worse.
Please help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nsb-ce" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nsb-ce?hl=en
-~----------~----~----~----~------~----~------~--~---