socket_broadcast(3)

πŸ“¦
version 0.34 Β· 2 versions
  • 0.34 Β· alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.30 Β· fedora 43, fedora 44, ubuntu jammy
, in alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ socket_broadcast β€” the manual page ✨

okay so this one lives in the Library Functions Manual, bestie, and it's genuinely so simple you're gonna slay it πŸ’…


🌸 NAME 🌸

socket_broadcast β€” flip a UDP socket into broadcast mode πŸ“£βœ¨


πŸŽ€ SYNTAX πŸŽ€

#include <libowfat/socket.h>

int socket_broadcast(int s);

πŸ’– DESCRIPTION πŸ’–

so socket_broadcast sets the UDP socket s to broadcast mode. that's the whole vibe. πŸ¦‹

and like, this part matters, okay? socket_send4 and socket_send6 will fail to send packets to the broadcast address unless you call socket_broadcast before. like, before before. no cap. πŸ™ˆ

normally socket_broadcast returns 0. iconic. flawless. no notes. ✨

but if anything goes wrong, it returns -1 and sets errno appropriately. so check your return values, babe, i'm begging 😭


🌈 EXAMPLE 🌈

#include <libowfat/socket.h>

int s;

if ((s=socket_udp6())==-1)
  strerr_die2sys(111,FATAL,"unable to create UDP socket: ");
if (socket_broadcast(s) == -1)
  strerr_die2sys(111,FATAL,"unable to set broadcast mode: ");

look at you go, setting up a socket and enabling broadcast and handling your errors like a whole main character πŸ‘‘πŸ’œ


πŸ’œ SEE ALSO πŸ’œ


and that's the page, bestie!! this lil cutie came from the Library Functions Manual, it's socket_broadcast(3), and yeah the footer is literally just socket_broadcast(3) again β€” no dramatic date, no version saga, just the section number doing its thing πŸŽ€ go forth and broadcast πŸ«ΆπŸ’–