MONGOC_SOCKET_SEND(3)

πŸ’… MONGOC_SOCKET_SEND(3) β€” like, the libmongoc girlies' guide to yeeting bytes into the void

okay so bestie, welcome to mongoc_socket_send from libmongoc β€” this is the one where you shove some bytes at a socket and hope the universe cooperates. it's giving "send it and pray" but make it systems programming 🫢


✨ SYNOPSIS ✨

ssize_t
mongoc_socket_send (mongoc_socket_t *sock,
                    const void *buf,
                    size_t buflen,
                    int64_t expire_at);

🌸 PARAMETERS 🌸

  • sock β€” a mongoc_socket_t. the socket. the main character. the thing you're sending to. πŸ‘‘
  • buf β€” a buffer to send. literally just the stuff you want to yeet out into the world πŸ’Œ
  • buflen β€” a size_t holding the number of bytes in buf. yes, you have to tell it how big your vibe is, it's not psychic πŸŽ€
  • expire_at β€” an int64_t with an absolute timeout for the operation, or 0. the timeout is in monotonic time using microseconds. you can grab the current monotonic time with System Clock. ngl, absolute timeouts are a whole mood β€” it's a deadline, not a countdown ⏰

πŸ¦‹ DESCRIPTION πŸ¦‹

Sends buflen bytes in buf to the destination.

If a timeout expired, the number of bytes sent will be returned β€” or -1 if no bytes were sent. so like, you might get a partial send, you might get nothing. no cap, that's just how it is 😭


⭐ RETURNS ⭐

-1 on failure, and errno is set. otherwise, the number of bytes sent. periodt πŸ’…

ok but fr fr β€” always check that return value. -1 plus an errno is the socket's way of telling you something went wrong, and it will tell you πŸ’€

🧚 AUTHOR 🧚

MongoDB, Inc


2009-present, MongoDB, Inc.


and that's the whole page, bestie, you ate πŸ’– this was libmongoc version 2.5.6, dated Oct 09, 2026 β€” like the footer says, but cuter. mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from