|
-
Feb 16th, 2001, 10:48 AM
#1
Thread Starter
Lively Member
Hey, my first question! Cool.
Well, I am having problems with the reliability of the winsock control. Seems like when the network is slow, different packets of data combines. Since i have to decode the data to process for usage, some of the data got mixed up and generate a type mismatch error.
For example, the program is supposed to send abc123 and def456 after that, the receiving side will get 'abc123def456'. My program crashes because of that. How can I ensure that the 2 packets go seperate?
Thanks for any answers.
-
Feb 19th, 2001, 11:50 AM
#2
Retired VBF Adm1nistrator
Use something along the following lines :
Code:
Private Sub Winsock1_Connect()
Winsock1.SendData "abc123"
CanGo = True
End Sub
Private Sub Winsock1_SendComplete()
If CanGo Then Winsock1.SendData "def456"
End Sub
Either that, or send some sort of control character, or characters along that pad the data. Then use split() when the data arrives. If the UBound of the array > 0, then data has been combined, and you can deal with it accordingly.
- jamie
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|