diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-12-31 13:26:44 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-12-31 13:26:44 -0800 |
| commit | b0874b1dad787c32093a3ff81311e2d638dc6538 (patch) | |
| tree | cde1005cef02954893fe2d9786d248930f857200 /docs/ref/api/sock.md | |
| parent | 2a4a14646f95b21cbc8f9b5bef8d76cd0fe04fec (diff) | |
| download | nng-b0874b1dad787c32093a3ff81311e2d638dc6538.tar.gz nng-b0874b1dad787c32093a3ff81311e2d638dc6538.tar.bz2 nng-b0874b1dad787c32093a3ff81311e2d638dc6538.zip | |
socket: rename nng_close to nng_socket_close
Diffstat (limited to 'docs/ref/api/sock.md')
| -rw-r--r-- | docs/ref/api/sock.md | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/docs/ref/api/sock.md b/docs/ref/api/sock.md index 59570240..40190d33 100644 --- a/docs/ref/api/sock.md +++ b/docs/ref/api/sock.md @@ -127,6 +127,28 @@ The following functions open a socket in [raw] mode: - {{i:`nng_sub0_open_raw`}} - [SUB][sub] version 0, raw mode - {{i:`nng_surveyor0_open_raw`}} - [SURVEYOR][surveyor] version 0, raw mode +## Closing a Socket + +```c +int nng_socket_close(nng_socket s); +``` + +The {{i:`nng_socket_close`}} function closes a socket, releasing all resources +associated with it. Any operations that are in progress will be terminated with +a result of [`NNG_ECLOSED`]. + +> [!NOTE] +> Closing a socket also invalidates any [dialers][dialer], [listeners][listener], +> [pipes][pipe], or [contexts][context] associated with it. + +> [!NOTE] +> This function will wait for any outstanding operations to be aborted, or to complete, +> before returning. Consequently it is not safe to call this from contexts that cannot +> block. + +> [!NOTE] +> Closing the socket may be disruptive to transfers that are still in progress. + ## Polling Socket Events ```c |
