[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

MTU problem while sending data DataGram packet size >= 10000

Posted on 2009-05-19
6
Medium Priority
?
433 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 1500 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

656 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