473,507 Members | 2,545 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Maximum Datagram size for UDP Sockets

Hello,

Does anyone know how to get the maximum size of a datagram for a UDP Socket
created via .NET's System.Net.Sockets.Socket class?

Thanks!
Nov 17 '05 #1
4 33658
UDP messages are called "datagrams" because they assume each
message will fit within a single packet for delivery. However, defining the
maximum size of a UDP datagram depends on lots of factors.

The length field of the UDP header allows up to 65535 bytes of data.
However, if you are sending your UDP packet across an Ethernet network, the
Ethernet MTU is 1500 bytes, limiting the maximum datagram size. Also, some
routers will attempt to fragment large UDP packets into 512 byte chunks.

So its more than .NET that determines "datagram" maximum size.
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Gregory Hassett" wrote:
Hello,

Does anyone know how to get the maximum size of a datagram for a UDP Socket
created via .NET's System.Net.Sockets.Socket class?

Thanks!

Nov 17 '05 #2
joe
"Gregory Hassett" <gh******@hotmail.com> writes:
Does anyone know how to get the maximum size of a datagram for a UDP
Socket created via .NET's System.Net.Sockets.Socket class?


A UDP datagram can't be more than 64K because the length is a 16 bit
integer (regardless of language or environment). I can't find .NET
documentation that states that so it might do something under the
covers to make you think it will send bigger datagrams, but I wouldn't
count on it.

Joe
--
Gort, klatu barada nikto
Nov 17 '05 #3
joe
"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> writes:
UDP messages are called "datagrams" because they assume each message
will fit within a single packet for delivery. However, defining the
maximum size of a UDP datagram depends on lots of factors.

The length field of the UDP header allows up to 65535 bytes of data.
However, if you are sending your UDP packet across an Ethernet
network, the Ethernet MTU is 1500 bytes, limiting the maximum
datagram size. Also, some routers will attempt to fragment large UDP
packets into 512 byte chunks.


The MTU doesn't limit the maximum datagram size, the length field in
the IP header does. Fragmentation is performed routinely when the
datagram size exceeds the physical capacity of a network segment. I'm
not sure where the 512 byte chunks come from though, it depends on
what can be sent over the next link.

Joe
--
Gort, klatu barada nikto
Nov 17 '05 #4

"Gregory Hassett" <gh******@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hello,

Does anyone know how to get the maximum size of a datagram for a UDP
Socket
created via .NET's System.Net.Sockets.Socket class?

Thanks!


The maximum UDP Datagram size is determined by the underlying transport and
the subnet, .NET (or more exactly the Winsock library) has nothing to do
with this. The max. size can never exceed 64Kb, to get the max. size of the
outbound (send) message supported by the local transport provider (note
"local provider" here ! that means that the value returned is not
necessarily the message size that can be used end-to-end), you'll have to
call GetSockopt through PInvoke. Note that there is no way to get the
receive max. message size.

Willy.


Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4071
by: Dave | last post by:
Hi, This is doubtless a really dumb question but is there an elegant way of reading numbers formatted as hex from a datgram? I get a datgram which contains values like this: ---DATAGRAM---...
5
30331
by: daniel.shaya | last post by:
I'll try and keep this brief so in a nutshell: I have large distributed java system running on a Windows 2003 server (4cpu 8Gb memory). Periodically the following exceptions occurs in the...
0
1230
by: Jonathan Ellis | last post by:
I seem to be running into a limit of 64 queued datagrams. This isn't a data buffer size; varying the size of the datagram makes no difference in the observed queue size. If more datagrams are...
2
28526
by: Kums | last post by:
What is the maximum permissible size of a database? Is there any limitation. What is the maximum # of tablespace's allowed in a database? Thanks for your response.
6
6250
by: Iain King | last post by:
Hi. I've been looking everywhere for this and can't find it, apologies if I'm being obtuse: How do I set the max datagram packet size? I'm using the socket module. It seem like it's hardcoded...
2
1405
by: DaTurk | last post by:
I know in TCP if you send a message down the wire, the OS may lump subsequent messages into a buffer before sending it across the wire, for efficiency. But, will the OS do the same thing with UDP?...
1
3553
by: greenxiar | last post by:
My code is below and the platform is Win2K3 R2: using System; using System.Net; using System.Net.Sockets; using System.Threading; namespace TechUDPBroadcast { class Program { static void...
6
2336
by: 7stud | last post by:
I'm trying to understand datagrams. My client program sends a message to the server, and then the server infinitely loops over the recv() to make sure all the data was received. I'm trying to use...
8
3402
by: babakandme | last post by:
How can I read IP Datagram? Should I write some Driver for that? Is there any special book about it? Thank you.
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7110
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7030
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.