Mismatched incoming data with Visual FoxPro

I am not having any problems with my outgoing messages, but my incoming messages do not match the messages being generated on the other end.

Date Entered: 10/11/2001    Last Updated: 10/11/2001

If the first character of the message received on the socket port is 00x00 (null), Visual FoxPro interprets this as an instruction to read the rest of the message from its memory buffer.

You will need to assign the DataInTextB result to an array memvar, convert each character in the array to a character value, and append it to a character string that we could then read. The following code assigns the DataInTextB value to a Visual FoxPro array:

laTest=THIS.DataInTextB 
...
gcReceiveString="" 
FOR ln=1 TO ALEN(laTest,1) 
     gcREceiveString=gcReceiveString+CHR(laTest[ln]) 
ENDFOR

If the null byte appears anywhere else in the message, VFP handles it just fine without conversion.


We appreciate your feedback.  If you have any questions, comments, or suggestions about this entry please contact our support team at kb@nsoftware.com.