Solved

Internet communication problem (UDP)

Posted on 2001-06-03
4
436 Views
Last Modified: 2010-04-06
Hello.

I'm currently developing a program that is suppose to
receive UDP packets.

I've successfully managed to send and receive single
UDP packets, however I need to receive a "stream" type
of udp packets. Example:

A server sends X UDP packets to me, how do I know when
the server is done sending? (I don't know how many packets the server will send and there is NO data within
the packet that will tell me that!)

The protocol that the server is using simply says:
.... but for now you just need to test for the end of the stream when you are reading in the constent string.

So my question is, how do i "test" for the end of a UDP stream? My socket is non-blocking (async)

To accept an answer I need source code, if component then there must be source to that too!

0
Comment
Question by:blasse
4 Comments
 
LVL 13

Accepted Solution

by:
Epsylon earned 200 total points
ID: 6150246
UDP is 'connectionless', so there's no way to know, unless you number the packets yourself.
Another problem is that if one packet gets lost, the client will never know, unless you take care of error correction yourself.
0
 
LVL 3

Expert Comment

by:smurff
ID: 6151848
To be honest, thats why theres TCP or UDP. If you use TCP then it will have error checking and once a peice of data is sent, a "ACK" will be sent back to say "yes Ive got that data thanks"
Is there a reason why it has to be UDP?
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 8891050
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Please accept Epsylon's comment as answer.

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Robert Marquardt
EE Cleanup Volunteer
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

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

17 Experts available now in Live!

Get 1:1 Help Now