Solved

MTU problem while sending data DataGram packet size >= 10000

Posted on 2009-05-19
6
427 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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
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 this video is to provide viewers with basic examples to understand opening and writing to 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…

777 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