Solved

sending long data through winsock

Posted on 2004-08-02
7
172 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This video teaches viewers about errors in exception handling.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

821 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