Solved

MTU problem while sending data DataGram packet size >= 10000

Posted on 2009-05-19
6
425 Views
Last Modified: 2012-05-07
Hi,
i have developed a Socket Program (UDP socket) and trying to send data over it.

i could able to send the data to other machine if packet size <1500.
But if more than that.. i cannot.
this is how i am sending my data...
"send(conn_socket, sendBuf , 10000, 0);"

Can you tell me how to over come this problem.

Environment:- C , Windows programming.
0
Comment
Question by:kishan66
6 Comments
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24426443
I have always found it is best to use < the ethernet MTU when programming UDP, as UDP packets will be silently discarded if they don't transmit, and large frames are sensitive to loss. If the network has to breakup the packet to transmit, and one of the fragments fails, the whole thing fails, and you will not know.

If you need large packets, I advise using TCP. It already has designed in all of the algorithms to take care of retry, etc. I reserve use of UDP for smaller packets. If your packet doesn't arrive, you have to retry. This is what TCP does for you.

So why is there a need for UDP when sending such large frames? Are you trying to tune performance of an existing network app?

0
 
LVL 86

Expert Comment

by:jkr
ID: 24426480
Send you data in smaller chunks. E.g.
size_t data_size = 1000;

size_t steps = data_size / 1024;

size_t remainder = data_size % 1024;

size_t  i;
 

for (i = 0; i < steps; ++i) {
 

  send(conn_socket, sendBuf + (i * 1024), 1024, 0);

}
 

send(conn_socket, sendBuf + (i * 1024), remainder, 0);

Open in new window

0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24426561
The problem with sending in smaller chunks points out the weakness with UDP, there is no all or nothing. Packet 1, 3 and 5 can arrive, and 2 & 4 can get dropped, so you still have problems to deal with and likely TCP is the solution, otherwise you need to write retry/acknowledge into your app.

0
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

 

Author Comment

by:kishan66
ID: 24426609
hi,
basically i am sending Video frames 10 per sec (where size of each frame =10kb) using UDP

hi jkr,
 do you think(your logic)  works for the video stuff???  
 
0
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 24426624
The logic itself works for any kind of data...
0
 
LVL 5

Expert Comment

by:Kimpan
ID: 24438867
If you are sending video stream in the local network, you might try out enabling and configuring jumbo packet settings on your NIC and adapt your packet size to it. To make this work, you need of course have routers/switches and hubs capable to handle jumbo frames. I guess you want to send big UDP packets because you wan't low packet overhead, low latency and you don't care if you miss some packets now and then?
0

Featured Post

IT, Stop Being Called Into Every Meeting

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

Suggested Solutions

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
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…

758 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

20 Experts available now in Live!

Get 1:1 Help Now