-   Programming (
-   -   Server Client program using UDP (

frostmagic 11-12-2003 12:16 PM

Server Client program using UDP
Right now i am doing a server client program to stream video. The 2 computers are connected by a cable. I am using UDP to do the streaming, i facing quite some problems. Since there is no external traffic , the file i stream over should be idenitical with the file in the server. But this dont happen, there are alway mismatch between the sizes.

This only happen when i stream file which are more than 600kb. Under 600kb, the size of the file at the client side will match. I check it with the ethereal, the server will send an arp packet to find out the client ip address. Could anyone help me solve this problem , i been stuck at this for like 2 months

druuna 11-12-2003 02:38 PM

udp might be the problem. It's fast, but has near to 0 error recovery options (unlike tcp). Mostly used for services where packetloss isn't that important.

From the RFC:
This protocol provides a procedure for application programs to send
messages to other programs with a minimum of protocol mechanism. The
protocol is transaction oriented, and delivery and duplicate protection
are not guaranteed.

infamous41md 11-12-2003 02:41 PM

yes u are almost guaranteed packet loss with UDP. since ur on a lan the packets are probably getting to the reader much faster than they can keep up with and packets are being dropped. increasing the read buffer size will help a bit, but you will still see packet loss.(stevens unpv1)

Hko 11-12-2003 02:46 PM

For a problem like this, without specific details or source code, we could only throw wild guesses at this.

frostmagic 11-13-2003 03:37 AM

hmm i wish try to post my code as soon as possible. Could it be during the sending of the ARP packet be the problem?

Kurt M. Weber 11-13-2003 03:31 PM

You're using'll just have to accept that there is some packet loss. But applications such as streaming sound, where a lot of data must be sent quickly (so minimal overhead is important, which UDP provides) and it's not important that all of it get there (when you're listening you're not going to notice a missing packet here or there) is exactly what UDP is designed for.

So I wouldn't worry too much, really. If you want everything to get there, use TCP--but be prepared for slower transfer times because of the additional overhead.

frostmagic 11-14-2003 10:52 AM

i need to ensure that everything get over there first so as to know whether my program is working fine a not. So i need it to be working

infamous41md 11-14-2003 04:02 PM

you should read chapter 20 of stevens unpv1. it details good methods of implementing reliability with udp. if you dont have that, try googling for a van jacobsen paper on the topic.

Kurt M. Weber 11-14-2003 06:31 PM

So if you need reliability/flow control, why not use TCP?

infamous41md 11-15-2003 12:06 AM

well often those type of applications used broadcasting or multicasting.

All times are GMT -5. The time now is 09:16 PM.