LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 11-12-2003, 12:16 PM   #1
frostmagic
LQ Newbie
 
Registered: Sep 2003
Posts: 28

Rep: Reputation: 15
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
 
Old 11-12-2003, 02:38 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
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.
 
Old 11-12-2003, 02:41 PM   #3
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
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)
 
Old 11-12-2003, 02:46 PM   #4
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 108Reputation: 108
For a problem like this, without specific details or source code, we could only throw wild guesses at this.
 
Old 11-13-2003, 03:37 AM   #5
frostmagic
LQ Newbie
 
Registered: Sep 2003
Posts: 28

Original Poster
Rep: Reputation: 15
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?
 
Old 11-13-2003, 03:31 PM   #6
Kurt M. Weber
Member
 
Registered: Oct 2003
Distribution: Slackware
Posts: 335

Rep: Reputation: 31
You're using UDP...you'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.
 
Old 11-14-2003, 10:52 AM   #7
frostmagic
LQ Newbie
 
Registered: Sep 2003
Posts: 28

Original Poster
Rep: Reputation: 15
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
 
Old 11-14-2003, 04:02 PM   #8
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
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.
 
Old 11-14-2003, 06:31 PM   #9
Kurt M. Weber
Member
 
Registered: Oct 2003
Distribution: Slackware
Posts: 335

Rep: Reputation: 31
So if you need reliability/flow control, why not use TCP?
 
Old 11-15-2003, 12:06 AM   #10
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
well often those type of applications used broadcasting or multicasting.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[most secure, open source, client/server file transfer program] Synesthesia Linux - Software 5 11-28-2005 09:20 PM
How to get IP address of client from server.c program nazsarwat Programming 1 04-22-2005 04:57 PM
how to get client ip address at udp server cranium2004 Programming 2 03-22-2005 12:35 AM
creating server socket program to handle multiple client at same time cranium2004 Programming 2 03-14-2005 11:58 AM
How speak irc client and irc server program? mech Linux - Networking 1 03-31-2004 06:23 PM


All times are GMT -5. The time now is 04:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration