summaryrefslogtreecommitdiff
path: root/docs/ref/compat/nn_socket.adoc
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2024-04-05 08:40:25 -0700
committerGarrett D'Amore <garrett@damore.org>2024-04-05 08:40:25 -0700
commit1b825b063da65fe3d88c1ca97afded0d6f6ccc14 (patch)
tree3d422dc27dc2a2c1146df0153ea9c97b17d28134 /docs/ref/compat/nn_socket.adoc
parent4d178a9eb65b973d18c80afa328a070ee09fd768 (diff)
downloadnng-1b825b063da65fe3d88c1ca97afded0d6f6ccc14.tar.gz
nng-1b825b063da65fe3d88c1ca97afded0d6f6ccc14.tar.bz2
nng-1b825b063da65fe3d88c1ca97afded0d6f6ccc14.zip
Compat pages converted.
Diffstat (limited to 'docs/ref/compat/nn_socket.adoc')
-rw-r--r--docs/ref/compat/nn_socket.adoc54
1 files changed, 54 insertions, 0 deletions
diff --git a/docs/ref/compat/nn_socket.adoc b/docs/ref/compat/nn_socket.adoc
new file mode 100644
index 00000000..d5e88652
--- /dev/null
+++ b/docs/ref/compat/nn_socket.adoc
@@ -0,0 +1,54 @@
+## nn_socket
+
+Create socket (compatible API).
+
+### Synopsis
+
+```c
+#include <nanomsg/nn.h>
+
+int nn_socket(int af, int proto);
+```
+
+### Description
+
+The `nn_socket` function creates socket using the address family _af_ and
+protocol _proto_ and returns it.
+
+The address family _af_ can be one of two values:
+
+[horizontal]
+`AF_SP`:: Normal socket.
+`AF_SP_RAW`:: Raw mode socket.
+
+The protocol indicates the protocol to be used when creating the socket.
+The following protocols are defined:
+
+[horizontal]
+`NN_PAIR`:: xref:nng_pair.adoc[Pair] protocol.
+`NN_PUB`:: xref:nng_pub.adoc[Publisher] protocol.
+`NN_SUB`:: xref:nng_sub.adoc[Subscriber] protocol.
+`NN_REQ`:: xref:nng_req.adoc[Requestor] protocol.
+`NN_REP`:: xref:nng_rep.adoc[Replier] protocol.
+`NN_PUSH`:: xref:nng_push.adoc[Push] protocol.
+`NN_PULL`:: xref:nng_pull.adoc[Pull] protocol.
+`NN_SURVEYOR`:: xref:nng_surveyor.adoc[Surveyor] protocol.
+`NN_RESPONDENT`:: xref:nng_respondent.adoc[Respondent] protocol.
+`NN_BUS`:: xref:nng_bus.adoc[Bus] protocol.
+
+### Return Values
+
+This function returns a valid socket number on success, and -1 on failure.
+
+### Errors
+
+[horizontal]
+`ENOMEM`:: Insufficient memory is available.
+`ENOTSUP`:: The protocol is not supported.
+`ETERM`:: The library is shutting down.
+
+### See Also
+
+xref:nng_socket.adoc[nng_socket],
+xref:nn_close.adoc[nn_close],
+xref:nn_errno.adoc[nn_errno] \ No newline at end of file