|
-
Sep 26th, 2000, 05:50 AM
#2
Sometimes 2 different Chuncks of data arrive Concatinated as if they were one.
Sometimes the second DataPacket Doesnt Get there at all.
Even when I am sending the same data to different Client (each Client has his own Dedicated Winsock Control) through a simple loop .. the data sometimes wont get to some Clients.
The weirdest I have ever experienced was while debugging the client app , I ran the server on a different Computer (Server) then I started Debugging the Client. Sometimes when I terminate the client And run it back again I get Bunch of data I sent to myself in the Previous Run.
When you use SendData, the data doesn't get sent the instant the instruction is performed, it takes abit of time before it is sent. So if you use something like:
Code:
Winsock1.SendData "Test"
Winsock1.Close
is unlikely to work as Winsock1 would have been closed before the send was finished. Similarly, if you are doing:
Code:
For i = 0 to NumberOfClients
Winsock1.SendData YourData
Next i
You can't be sure that the packet will get sent before the next time the loop comes back.
Also, SendData doesn't always do what you tell it to if you have two of its commands together, just as when you send a large file Winsock is likely to break it up, it might join two strings together if you do:
Code:
Winsock1.SendData "1"
Winsock1.SendData "2"
Just as you said, the most foolproof way out is using the SendComplete event. However, this usually requires alot more code if the types of data being sent/received varied alot (if its simple stuff, I will use Sleep or a loop of DoEvents.
Sunny
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
|