![]() |
| | #1 |
| Registered User Join Date: Jan 2009
Posts: 26
| udp max datagram size |
| baccardi is offline | |
| | #2 | |
| int x = *((int *) NULL); Join Date: Jul 2003 Location: Banks of the River Styx
Posts: 902
| This is a mystery that has eluded me for quite some time. After I researched it, this is the best I came up with. In theory, a UDP packet's size is the minimum of 65527 (UDP's max size) & any underlying layer. So, let's go down the layers. We already know UDP. Next is IP. IP packet size is 20 octets (or more) + data. Let's assume that no options are in use, and it's 20 octets for a header. That leaves 65535 - 20 (or more) for data, or 65515. Minus 8 for our UDP header, and that's 65507. (The number you were getting.) That's for IPv4 - IPv6 will be slightly different. Next layer is the link layer, ie ethernet or wireless, etc. This can vary from one section of a network to another too. The link layer has what is known as a "MTU", or max transmission unit. However, we shouldn't need to worry about this because IP will fragment packets for us. The kicker, however, comes in RFC 879 (RFC 791 states this as well) which states that hosts are required IP only requires that links be able to handle IP packets up to 576 octets and that Quote:
In practice, you might be able to send more than this, but I would call this a "safe maximum". As for becoming what RFC 879 calls "a host with specific knowledge that the destination host is prepared to accept larger datagrams", you can try Path MTU discovery, which is something I know nothing about.
__________________ long time; /* know C? */ Unprecedented performance: Nothing ever ran this slow before. Any sufficiently advanced bug is indistinguishable from a feature. Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31. The best way to accelerate an IBM is at 9.8 m/s/s. recursion (re - cur' - zhun) n. 1. (see recursion) Last edited by Cactus_Hugger; 03-18-2009 at 05:59 PM. | |
| Cactus_Hugger is offline | |
| | #3 |
| Malum in se Join Date: Apr 2007
Posts: 3,188
| links that can only handle 576 bytes are ancient, out-dated- and rarely encountered unless you are communicating with a 3rd world country, which means you still have to consider them when writing code. You will NEVER encounter one of these aritfacts unless you forget to write code to handle them, in which case your ISP will use nothign but those.
__________________ Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off. |
| abachler is offline | |
| | #4 |
| Registered User Join Date: Jan 2009
Posts: 26
| well i've read about mtu, and the minimum i could find was 1492 as i remember, so i succesfully use 1400 byte datagrams |
| baccardi is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Tutorial] Implementing the Advanced Encryption Standard | KONI | C Programming | 16 | 11-23-2007 01:48 PM |
| char problem | eXistenZ | Windows Programming | 36 | 02-21-2005 06:32 AM |
| Max size of an INT | Thantos | C Programming | 5 | 08-11-2003 07:43 AM |
| max int size | Unregistered | C++ Programming | 1 | 10-25-2001 11:32 AM |
| Hi, could someone help me with arrays? | goodn | C Programming | 20 | 10-18-2001 09:48 AM |