tetsuo3030
Programmer
Hello..I am having a problem retrieving data properly via Winsock in Foxpro 6.0. My client is supposed to receive an ASCII message that has 2-bytes attached to the front that is supposed to represent the length of the ASCII message in bytes.
for instance, if the incoming ASCII message is: 'abcdef'
then the message would come across as: chr(0) + chr(6) + 'abcdef'
obviously, I'm just using CHR(0) to represent the first byte(00000000) and CHR(6) to represent the second byte of the header(00000110)..
my problem is that by the time the Winsock method .DataArrival() fires, the data has been corrupted..I can try to print the data to file and all I see is blank spaces(although the length is correct). I have used Ethereal to verify that the data section of the packets I am receiving do indeed contain the correct information, so it seems that Foxpro/Winsock is unhappy with the first byte(the CHR(0)) and it seems to be corrupting the rest of the message somehow. Does anyone know how to get around this problem? I'm only receiving 1 large packet from the server application so I have to be able to pull the binary data "away" from the ASCII data somehow..
Any ideas?
for instance, if the incoming ASCII message is: 'abcdef'
then the message would come across as: chr(0) + chr(6) + 'abcdef'
obviously, I'm just using CHR(0) to represent the first byte(00000000) and CHR(6) to represent the second byte of the header(00000110)..
my problem is that by the time the Winsock method .DataArrival() fires, the data has been corrupted..I can try to print the data to file and all I see is blank spaces(although the length is correct). I have used Ethereal to verify that the data section of the packets I am receiving do indeed contain the correct information, so it seems that Foxpro/Winsock is unhappy with the first byte(the CHR(0)) and it seems to be corrupting the rest of the message somehow. Does anyone know how to get around this problem? I'm only receiving 1 large packet from the server application so I have to be able to pull the binary data "away" from the ASCII data somehow..
Any ideas?