March 2nd, 2003, 05:01 PM
data loss over winsock connection
i have 2 pretty simple programs, one acting as a server (listening on a certain port on my pc) and another as client (also running on my pc connecting to 127.0.0.1 on the server's port)....
they connect fine, and i have message boxes set up to show me what data is doing what...it appears that the data string i am trying to SEND to the server is fine, but once the server gets the data it instantly turns it into "????????????????"....
it also seems that the procedure gets confused as it never sends any data back to the client (which it is supposed to do) and my client program ends up timing out (it has a 30 second timer)....
here is the data arrival procedure in the server....
This is the procedure in the Client that sends the data to the server
thanks for any help on this, its about to drive me insane....
March 3rd, 2003, 01:44 PM
I don't have time to try out your code, but I can offer some suggestions.
1. Outgoing is ok, you're sending a string, so that's simple.
2. Incoming procedure is where the problem is. Your getting a Byte Array, not a string, so when your code implicitly converts the output from your getdata method in the object call:
What really happens is, you get something like this in the ByteArray first (in memory only)
bArray(0) = 0
bArray(1) = 14
bArray(2) = 0
bArray(3) = 32
Zeros, separated by the chars in Ascii code.
This is an Array that can probably be decoded using the following code converting FROM unicode to a non-unicode string.
Dim sOutput as String
sOutput = StrConv( wsCom(Index).GetData retData, vbFromUnicode )
May work, may not. Just a guess....
- Chris of Custom Fit Technology
Access to MySQL Conversion Tool,
Visual XSLT Conversion Tool