socket_recv6(3)
π socket_recv6(3) β bestie edition π
from the Library Functions Manual, aka the sacred texts β¨
πΈ NAME πΈ
socket_recv6 β receive a UDP datagram π«Ά
β¨ SYNTAX β¨
okay so first you gotta include the header, no cap:
#include <libowfat/socket.h>
ssize_t socket_recv6(int s, char* buf, size_t len,
char ip[16], uint16* port, uint32* scope_id);
π¦ DESCRIPTION π¦
so basically socket_recv6 receives up to len bytes starting at buf from a UDP datagram that came in on the socket s. it writes the UDP port to port and the IP address to ip, and it returns the number of bytes actually received β or -1 if anything went wrong π.
for link-local addresses, scope_id will become the network interface number, which you can translate into the actual name of the interface (like "eth0") using socket_getifname. iykyk π
π RETURN VALUE π
- if a datagram was received,
socket_recv6returns the number of bytes in it π - if not, it returns
-1and setserrnoappropriately π©
π EXAMPLE π
here's the vibe, literally copy-paste energy:
#include <libowfat/socket.h>
int s;
char ip[16];
uint16 p;
char buf[1000];
int len;
uint32 scope_id;
s = socket_tcp4();
socket_bind6(s,ip,p);
len = socket_recv6(s,buf,sizeof(buf),ip,&p,&scope_id);
π SEE ALSO π
and that's the whole page bestie, go forth and receive those datagrams π§β¨
this lil masterpiece lives in the Library Functions Manual, and the footer is just the page name again β socket_recv6(3) β like a lil signature at the bottom π slay.
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- debian bookworm: libowfat-dev 0.32-4 Β· GPL-2.0-only
- debian trixie: libowfat-dev 0.32-5 Β· GPL-2.0-only
- nixos 26.05: libowfat 0.34
- nixpkgs unstable: libowfat 0.34
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- ubuntu noble: libowfat-dev 0.32-4.1build1 Β· GPL-2.0-only
- ubuntu questing: libowfat-dev 0.32-5
- ubuntu resolute: libowfat-dev 0.34-2 Β· GPL-2.0-only
- ubuntu stonking: libowfat-dev 0.34-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms