MONGOC_SOCKET_CLOSE(3)
π MONGOC_SOCKET_CLOSE(3) π
okay bestie, so this is a page from the libmongoc manual (that's the MongoDB C driver crew, iykyk) and it's literally all about closing a socket. short page, but she's iconic. let's get into it β¨
πΈ SYNOPSIS πΈ
int
mongoc_socket_close (mongoc_socket_t *socket);
that's the whole vibe. returns an int, takes one pointer. slay.
π PARAMETERS π
socketβ Amongoc_socket_t. that's it. that's the parameter. the main character of this function π«Ά
π¦ DESCRIPTION π¦
okay so here's the tea: this function is a wrapper around the BSD socket shutdown() and close() functions β plus their Windows equivalents, because Windows gotta Windows π
here's the important part, no cap: the socket is shut down only if the current process is the same as the process that opened the socket. different process? no shutdown for you. π
Regardless, the socket is then closed. so either way, bestie, the close happens. periodt.
β RETURNS β
0on success π-1on failure to close the socket π
on failure, the socket's errno is set β grab it with mongoc_socket_errno(). don't forget, or you'll be staring at a -1 wondering what went wrong. not cute.
π AUTHOR π
MongoDB, Inc β the legends themselves.
π COPYRIGHT π
2009-present, MongoDB, Inc.
mwah π that's the page. version 2.5.6, dated Oct 09, 2026 β go close some sockets responsibly, bestie. πβ¨
π¦ where this page comes from
- epel 10: mongo-c-driver-devel 2.5.6-1.el10_3 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms