Sending Binary Data in Visual FoxPro
When passing a character string to an OLE (ActiveX) component, Visual FoxPro automatically converts the string using the current code page. This conversion can change the values of bytes in binary data, such as null bytes or bytes above 127.
To send binary data with a method such as the SendBytes method of the TCPClient component, first convert the string to a binary string using the Visual FoxPro CREATEBINARY() function. This prevents Visual FoxPro from converting the data, so that the exact byte values are sent.
cData = CHR(0) + CHR(0) + CHR(4) + CHR(183)
oTCPClient.SendBytes(CREATEBINARY(cData))
Note that in older versions of IPWorks, data was sent by setting the DataToSendB property.
We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@nsoftware.com.