Click to See Complete Forum and Search --> : Winsock problem


Cakkie
February 3rd, 2000, 07:30 AM
I have this code that gets data from a winsock element using TCP/IP and prints it to the debug windows, but something strange is going on.

private sub Winsock_dataArrival(bytesReceived as long)

dim strData as string
Winsock.GetData strData
debug.print strData

End sub



When I use another program and send data to that port, the data received looks funny, the first few characters are question marks. It's not a constant number of ?'s, sometimes there are 3, another time there are 7, it's always different.
eg. I send 'subject: this is a test' it arrives as '????ect: this is a test' or as '???????: this is a test'
I am using port 600 to do this, and the connection appears to be made correctly.

Aaron Young
February 3rd, 2000, 08:23 AM
Try specifying the Type of Data you expect to recieve and how many Bytes you want, ie.

Winsock.GetData strData, vbString, bytesReceived

Aaron Young
Analyst Programmer
ajyoung@pressenter.com
aarony@redwingsoftware.com