UDPLITE(4)
π UDPLITE(4) β bestie edition π
okay so. sit down, grab a strawberry something, because we're talking about udplite β the Lightweight User Datagram Protocol β and this is genuinely one of my fave little gremlins in the kernel. this page lives in the Kernel Interfaces Manual, and yes it's giving β¨niche but iconicβ¨. iykyk.
πΈ NAME πΈ
udplite β Lightweight User Datagram Protocol π¦
β¨ SYNOPSIS β¨
like, the whole vibe in code form:
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/udplite.h>
int
socket(AF_INET, SOCK_DGRAM, IPPROTO_UDPLITE);
so you include those three headers β sys/types.h, sys/socket.h, and netinet/udplite.h β and then you make the socket with AF_INET, SOCK_DGRAM, and IPPROTO_UDPLITE. no cap, that's it. π
π DESCRIPTION π
okay bestie, here's the tea β. the UDP-Lite protocol provides a partial checksum which allows corrupted packets to be transmitted to the receiving application. the way that lower-layer protocols would normally just yeet a damaged datagram into the void? UDP-Lite is like, "no, actually, let them have it." π
and this has advantages for some types of multimedia transport that may be able to make use of slightly damaged datagrams, rather than having them discarded by lower-layer protocols. some apps would genuinely rather have a slightly crunchy packet than no packet at all. main character behaviour fr fr π«Ά
UDP-Lite supports a number of socket options which can be set with setsockopt(2) and tested with getsockopt(2) β and here they are, the whole squad:
UDPLITE_SEND_CSCOVβ this option sets the sender checksum coverage. a value of zero indicates that all sent packets will have full checksum coverage. a value of 8 to 65535 limits the checksum coverage of all sent packets to the value given. π«UDPLITE_RECV_CSCOVβ this option is the receiver-side analogue. a value of zero instructs the kernel to drop all received packets not having full checksum coverage. a value of 8 to 65535 instructs the kernel to drop all received packets with a partial checksum coverage smaller than the value specified. π (yes, the kernel is petty and it will absolutely discard things. it said "vibe check failed.")
π ERRORS π
a socket operation may fail with one of the following errors returned. ngl these are the little landmines, so let's go:
[EISCONN]β when trying to establish a connection on a socket which already has one, or when trying to send a datagram with the destination address specified and the socket is already connected. like bestie, it's already connected, stop trying to connect again π[ENOTCONN]β when trying to send a datagram, but no destination address is specified, and the socket has not been connected. you can't send a message with no address and no connection, that's just shouting into the void π[ENOBUFS]β when the system runs out of memory for an internal data structure. the machine is full, it said no more π[EADDRINUSE]β when an attempt is made to create a socket with a port which has already been allocated. that port is TAKEN, find your own π[EADDRNOTAVAIL]β when an attempt is made to create a socket with a network address for which no network interface exists. that address is a ghost, there's no interface there π»
π SEE ALSO π
go read these next, they're the friends of this page:
getsockopt(2), recv(2), send(2), socket(2) β¨
and that's the whole page, bestie. this beauty comes to you from Debian, dated October 1, 2014 β an elder, but a legend, and we respect her π. slay, go write some partial checksums. periodt. ππβ
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2014, Kevin Lo
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms