summaryrefslogtreecommitdiff
path: root/docs/reference/src/api/socket
diff options
context:
space:
mode:
Diffstat (limited to 'docs/reference/src/api/socket')
-rw-r--r--docs/reference/src/api/socket/index.md1
-rw-r--r--docs/reference/src/api/socket/nng_bus_open.md40
-rw-r--r--docs/reference/src/api/socket/nng_close.md45
-rw-r--r--docs/reference/src/api/socket/nng_pub_open.md53
4 files changed, 139 insertions, 0 deletions
diff --git a/docs/reference/src/api/socket/index.md b/docs/reference/src/api/socket/index.md
new file mode 100644
index 00000000..990b7cbb
--- /dev/null
+++ b/docs/reference/src/api/socket/index.md
@@ -0,0 +1 @@
+# Protocol Sockets
diff --git a/docs/reference/src/api/socket/nng_bus_open.md b/docs/reference/src/api/socket/nng_bus_open.md
new file mode 100644
index 00000000..a579acfb
--- /dev/null
+++ b/docs/reference/src/api/socket/nng_bus_open.md
@@ -0,0 +1,40 @@
+# nng_bus_open()
+
+## NAME
+
+nng_bus_open --- create bus socket
+
+## SYNOPSIS
+
+```c
+#include <nng/nng.h>
+#include <nng/protocol/bus0/bus.h>
+
+int nng_bus0_open(nng_socket *s);
+
+int nng_bus0_open_raw(nng_socket *s);
+```
+
+## DESCRIPTION
+
+The `nng_bus0_open()` function creates a [_BUS_](../protocols/bus.md) version 0
+[socket](nng_socket.md) and returns it at the location pointed to by _s_.
+
+The `nng_bus0_open_raw()` function creates a [_BUS_](../protocols/bus.md) version 0
+[socket](nng_socket.md) in
+[raw](../overview/raw.md) mode, and returns it at the location pointed to by _s_.
+
+## RETURN VALUES
+
+These functions return 0 on success, and non-zero otherwise.
+
+## ERRORS
+
+- `NNG_ENOMEM`: Insufficient memory is available.
+- `NNG_ENOTSUP`: The protocol is not supported.
+
+## SEE ALSO
+
+[nng_socket()](nng_socket.md),
+[BUS protocol](../protocols/bus.md),
+[RAW mode](../overview/raw.md)
diff --git a/docs/reference/src/api/socket/nng_close.md b/docs/reference/src/api/socket/nng_close.md
new file mode 100644
index 00000000..486cfe2c
--- /dev/null
+++ b/docs/reference/src/api/socket/nng_close.md
@@ -0,0 +1,45 @@
+# nng_close(3)
+
+## NAME
+
+nng_close --- close socket
+
+## SYNOPSIS
+
+```c
+#include <nng/nng.h>
+
+int nng_close(nng_socket s);
+```
+
+## DESCRIPTION
+
+The `nng_close()` function closes the supplied socket, _s_.
+Messages that have been submitted for sending may be flushed or delivered,
+depending upon the transport.
+
+Further attempts to use the socket after this call returns will result
+in `NNG_ECLOSED`.
+Threads waiting for operations on the socket when this
+call is executed may also return with an `NNG_ECLOSED` result.
+
+> [!NOTE]
+> Closing the socket while data is in transmission will likely lead to loss
+> of that data.
+> There is no automatic linger or flush to ensure that the socket send buffers
+> have completely transmitted.
+> It is recommended to wait a brief period after calling
+> [`nng_send()`](nng_send.md) or similar functions, before calling this
+> function.
+
+## RETURN VALUES
+
+This function returns 0 on success, and non-zero otherwise.
+
+## ERRORS
+
+- `NNG_ECLOSED`: The socket _s_ is already closed or was never opened.
+
+## SEE ALSO
+
+[nng_socket](nng_socket.md)
diff --git a/docs/reference/src/api/socket/nng_pub_open.md b/docs/reference/src/api/socket/nng_pub_open.md
new file mode 100644
index 00000000..c9f3b5b5
--- /dev/null
+++ b/docs/reference/src/api/socket/nng_pub_open.md
@@ -0,0 +1,53 @@
+= nng_pub_open(3)
+//
+// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2018 Capitar IT Group BV <info@capitar.com>
+//
+// This document is supplied under the terms of the MIT License, a
+// copy of which should be located in the distribution where this
+// file was obtained (LICENSE.txt). A copy of the license may also be
+// found online at https://opensource.org/licenses/MIT.
+//
+
+== NAME
+
+nng_pub_open - create pub socket
+
+== SYNOPSIS
+
+[source,c]
+----
+#include <nng/nng.h>
+#include <nng/protocol/pubsub0/pub.h>
+
+int nng_pub0_open(nng_socket *s);
+
+int nng_pub0_open_raw(nng_socket *s);
+----
+
+== DESCRIPTION
+
+The `nng_pub0_open()` function creates a xref:nng_pub.7.adoc[_pub_] version 0
+xref:nng_socket.5.adoc[socket] and returns it at the location pointed to by _s_.
+
+The `nng_pub0_open_raw()` function creates a xref:nng_pub.7.adoc[_pub_] version 0
+xref:nng_socket.5.adoc[socket] in
+xref:nng.7.adoc#raw_mode[raw] mode and returns it at the location pointed to by _s_.
+
+== RETURN VALUES
+
+These functions return 0 on success, and non-zero otherwise.
+
+== ERRORS
+
+[horizontal]
+`NNG_ENOMEM`:: Insufficient memory is available.
+`NNG_ENOTSUP`:: The protocol is not supported.
+
+== SEE ALSO
+
+[.text-left]
+xref:nng_socket.5.adoc[nng_socket(5)],
+xref:nng_pub.7.adoc[nng_pub(7)],
+xref:nng_sub.7.adoc[nng_sub(7)],
+xref:nng.7.adoc[nng(7)]