Solved

sending long data through winsock

Posted on 2004-08-02
7
169 Views
Last Modified: 2013-11-13
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
0
Comment
Question by:doyledom
  • 2
7 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 75 total points
ID: 11694552
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
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 75 total points
ID: 11695900
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
 
LVL 76

Expert Comment

by:David Lee
ID: 11697936
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
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11697980
>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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now