|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Anyone looking for a way to modernize legacy data or easily migrate to a more cost-effective database without sacrificing functionality will benefit from this seminar. View the Intro to Advantage Database Server now! |
|
#1
|
||||
|
||||
|
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.... Quote:
This is the procedure in the Client that sends the data to the server Quote:
thanks for any help on this, its about to drive me insane.... |
|
#2
|
|||
|
|||
|
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: wsCom(Index).GetData retData 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 ... etc 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 ) Msgbox sOutput May work, may not. Just a guess....
__________________
- Chris of Custom Fit Technology http://www.customfittech.com Access to MySQL Conversion Tool, Visual XSLT Conversion Tool |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > data loss over winsock connection |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|