Solved

MTU problem while sending data DataGram packet size >= 10000

Posted on 2009-05-19
6
426 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

920 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

15 Experts available now in Live!

Get 1:1 Help Now