sending long data through winsock

I want my program to be able to send long data through winsock in packets of 3000 bytes.
My code is constructed of:

strData - Date to send through winsock

If Len(strData) > "4000" Then
split the data here so it sends 4000 bytes then it checks again to see if its over 4000 and so on. therefore a loop will be added...


What is the code to tell use that the winsock is finished sending the first packet so we can move onto the next?
Thank you for your time
doyledomAsked:
Who is Participating?
 
Jaime OlivaresConnect With a Mentor Software ArchitectCommented:
You can send a packet size field before your actual data, so your receiving function reads it first and prepare to read sized data.
0
 
Carl TawnConnect With a Mentor Systems and Integration DeveloperCommented:
The other method is to attach a special character or sequence of characters to the end of each packet to indicate that more is coming.
0
 
David LeeCommented:
If I remember correctly there's no guarantee of the order in which packets will be delivered.  You might need to send a packet telling the distant end to expect x number of additional packets and then have it send a reply back acknowledging that before you begin sending the real data packets.  Just a thought.  I haven't used Winsock a lot, but enough to know that it doesn't always behave as you might expect.
0
 
Jaime OlivaresSoftware ArchitectCommented:
>If I remember correctly there's no guarantee of the order in which packets will be delivered.
This is in case of using UDP frames (author has not specified frame type)

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.