MONGOC_STREAM_SETSOCKOPT(3)

πŸ¦‹ MONGOC_STREAM_SETSOCKOPT(3) πŸ¦‹

okay so bestie, you're in the libmongoc section 3 manual and today's main character is mongoc_stream_setsockopt() β€” literally the little bridge between your stream and the socket options you wanna set. it's giving "middle management but make it cute" πŸ’…


✨ SYNOPSIS ✨

int
mongoc_stream_setsockopt (mongoc_stream_t *stream,
                          int level,
                          int optname,
                          void *optval,
                          mongoc_socklen_t optlen);

πŸŽ€ PARAMETERS πŸŽ€

  • stream β€” a mongoc_stream_t. this is the stream we're messing with, bestie 🫢
  • level β€” the level you'd pass to setsockopt(). yes, exactly that one, no cap.
  • optname β€” the optname you'd pass to setsockopt(). matching set, love that for us ⭐
  • optval β€” the optval you'd pass to setsockopt(). it's a void *, so behave 😭
  • optlen β€” the optlen you'd pass to setsockopt(). it's a mongoc_socklen_t, keep the types straight πŸ’–

so like, the whole vibe here: this function is a wrapper around setsockopt() for streams that wrap sockets. that's the entire lore. if your stream is a socket-in-a-trenchcoat, this is how you poke at its socket options 🌸


πŸ”₯ RETURNS πŸ”₯

0 on success β€” slay, we love a clean zero πŸ’š

otherwise -1 and errno is set. yeah, it's giving error handling, check your errno fr fr πŸ’€


πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc β€” iconic, we stan 🫢


2009-present, MongoDB, Inc. β€” the whole run, no gaps, periodt πŸ’œ


and that's the page bestie!! ✨ signed off from libmongoc version 2.5.6, dated Oct 09, 2026 β€” go forth and set those sockopts responsibly πŸ§šπŸ’–

πŸ“¦ where this page comes from