Re: Linux Sockets UDP and fragmentation
- From: Ben Bacarisse <ben.usenet@xxxxxxxxx>
- Date: Mon, 01 Dec 2008 14:10:46 +0000
"toobee84@xxxxxxxxxxxxxx" <toobee84@xxxxxxxxxxxxxx> writes:
i try to write a c-program that sends udp-packages. works so far, but
if i try to send packages that are bigger for example 10.000 Byte i
receive "Message too long" error from my sendto()-call.
i expected that the socket api would automatic fragment my too-large
package in smaller pieces so that things would fit but i obviously
don't. does that mean i have to ask the network for its MTU and the
split my package into pieces ?
No, you can't get round the upper limit of one IP datagram.
Fragmentation may occur, but that will affect things like
performance -- it will not affect how large a packet you can send.
Even then, since UDP gives you no delivery guarantees, the network is
permitted to drop even small packets.
For practical purposes, you would not want to even approach this
theoretical limit. In the days when I knew about such things, it was
considered unwise to use a payload bigger than about 1200 bytes for a
UDP datagram and I'd be surprised if this has changed much.
Or am i doing something wrong, i wrote a program that used tcp instead
of udp and there it was not necessary to split the packages (i suppose
it happend automatically).
TCP is designed to do this (and more). UDP does not do this. In
fact, UDP is about the simplest transport-layer protocol that you can
imagine over running IP. If you need reliable transfer or have large
amounts of data you should probably not use UDP.
There used to some proposals around for reliable, uni-directional,
large datagram protocols, but I don't think any became widely used.
--
Ben.
.
- Follow-Ups:
- Re: Linux Sockets UDP and fragmentation
- From: toobee84@xxxxxxxxxxxxxx
- Re: Linux Sockets UDP and fragmentation
- References:
- Linux Sockets UDP and fragmentation
- From: toobee84@xxxxxxxxxxxxxx
- Linux Sockets UDP and fragmentation
- Prev by Date: Re: Lock-free reference counting
- Next by Date: Re: Why PHP is so succesfull?
- Previous by thread: Linux Sockets UDP and fragmentation
- Next by thread: Re: Linux Sockets UDP and fragmentation
- Index(es):
Relevant Pages
|