Solved

MTU problem while sending data DataGram packet size >= 10000

Posted on 2009-05-19
6
431 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
Industry Leaders: 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 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

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!

Question has a verified solution.

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

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall‚Ķ
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

707 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