Hi,
Looks to me as if your current method of constructing the header is just a more complicated way of achieving the same thing as your old method (assuming that the message length will not, as you stated, exceed 256 characters). I.e. CHR(0)+CHR(LEN(msg))+msg would be fine. The only real change you seem to have made is applying CreateBinary() to the header as well as the message body which I just noticed you were not doing originally.
As far as the incoming msg is concerned can you explain what you mean by 'all blanked out'?
Regards,
Viv
>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only