Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Binary Header on ASCII Transmission - Problems
Message
From
26/09/2005 15:42:59
 
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 6
OS:
Windows XP
Network:
Novell 5.x
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01052700
Message ID:
01053194
Views:
11
Thanks all, but I've got the first part of the problem figured out..I used the following code to create the string which I'm sending out:

lcMsgWithoutHeader = tcTransmission
lnMsgLength = len(lcMsgWithoutHeader)
lcMsgHeader = chr(lnMsgLength % 256)
for i = 1 to 3
lcMsgHeader = chr(bitrshift(lnMsgLength,i*8) % 256) + lcMsgHeader
endfor
lcMsgWithHeader = lcMsgHeader + lcMsgWithoutHeader
lcSendData = createbinary(SUBSTRC(lcMsgWithHeader, 3) + CHR(13))

The only strange part here is that I'm using the SUBSTRC() in the CREATEBINARY() line in order to strip the first two bytes...This was because this was some preexisting code that was meant for a 4-byte header and I only need 2 bytes. I probably could've avoided this by only executing the contents of the FOR loop only once(thus having the chr(lnMsgLength % 256) for creating the rightmost-byte and then shifting it over using the BITRSHIFT() command...
-----------------
I have a new problem but it is completely related to this. Using the above code is allowing me to successfully send messages to the server which is getting the messages, validating them and sending me the replies. My problem is that I'm running into the same "binary header" problem that I had when sending the messages out. In this case, I can use Ethereal to see the packets and the data looks exactly as I expect, but by the time the data is received in the MSWinsock method .DataArrival it is all blanked out(assumedly from the leading 00000000 byte)..

So the first two bytes of the reply are 00000000 01000110 which should signify the length of the following part(ASCII Message), 70.

Any idea how to get around this problem?

Thanks, Jon
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform