roar_socket_listen(3)

πŸ“¦ version 1.0~beta12, in ubuntu jammy

πŸ’– roar_socket_listen β€” bestie's guide to opening a listen socket πŸ’–

okay so this is a page from the System Manager's Manual: RoarAudio section 3, and it's literally just roar_socket_listen(3). sit down, grab a strawberry πŸ“, and let's get into it.


✨ NAME ✨

roar_socket_listen β€” opens a new listen socket. that's it, that's the whole vibe. it's giving "come through, clients" πŸ’…


🌸 SYNOPSIS 🌸

#include <roaraudio.h>

int roar_socket_listen(int type, char * host, int port);

look at her. three little args. main character energy fr fr. πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

so like, this function opens a brand new listening socket β€” the kind that network clients can connect to. think of it as rolling out the pink carpet and waiting for the girlies to arrive. 🫢

once it's open, you can accept new connections via accept(2). yes, that accept(2). go look it up, iykyk.


πŸ’œ PARAMETERS πŸ’œ

  • type β€” the type of the Socket. there's a whole list of them down below, keep reading bestie πŸ‘‡
  • host β€” the host or path name to listen on. and no, it's not always a hostname β€” it depends on the type argument. for TCP/IP, if you wanna listen on any interface, you pass a value of "0.0.0.0". that's the "i'm open to everyone" address, no cap.
  • port β€” the port number to listen on. some types don't do port numbers at all, so this one may just get ignored by them. not her fault, she's just built different. πŸ™ˆ

πŸ”₯ SOCKET TYPES πŸ”₯

ROAR_SOCKET_TYPE_UNKNOWN

the type gets auto detected. do not use this if you already know the type, bestie, i'm serious. only use it when you're handling user-given addresses and you actually need that auto detection magic. ✨

ROAR_SOCKET_TYPE_TCP

use a TCP/IP connection. this is the standard mode for networking, the moment, the icon. host is the hostname or IP to listen on, and port is the port number to use. πŸ‘‘

ROAR_SOCKET_TYPE_INET

same as the one above but deprecated. like, it's giving vintage but not in a cute way. use ROAR_SOCKET_TYPE_TCP instead, periodt.

ROAR_SOCKET_TYPE_UNIX

UNIX Domain Socket. this one should be the default for local connections. host is the filename of the socket. very local, very cozy, very demure. 🌸

ROAR_SOCKET_TYPE_DECNET

DECnet socket. that's the whole description. she's mysterious like that. πŸ’€

ROAR_SOCKET_TYPE_FORK

this is to fork a roard to communicate with. can't be used to listen on, only to connect to. host and port are ignored at the moment. so like, read the room, don't try to listen with this one. 😭

ROAR_SOCKET_TYPE_FILE

this is used to open a plain file. can't be used to listen on, just to connect to. host is the filename to connect to. again: not a listening type. don't do it. 🫠


🌈 RETURN VALUE 🌈

  • on success, these calls return a filehandle. slay. πŸ’–
  • on error, -1 is returned. sad girl hours. 😭

πŸ’€ BUGS πŸ’€

listening on UDP sockets is not supported at the moment. so if that was your plan... no it wasn't. πŸ™ˆ

πŸŽ€ EXAMPLES πŸŽ€

FIXME

(no literally, that's what it says. the examples section is a FIXME. we're all just waiting. it's fine. it's fine. 🧚)


⭐ SEE ALSO ⭐


okay that's the whole page, bestie, you ate that. this was the RoarAudio manual page for roar_socket_listen(3), dated May 2011 β€” yes, may 2011, she's an elder but she still serves πŸ’…. mwah, go forth and listen responsibly πŸ«ΆπŸ’–βœ¨

πŸ“¦ where this page comes from