Debian Codegraph @

man/transports.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/docs.R
3 \name{transports}
4 \alias{transports}
5 \title{Transports (Documentation)}
6 \description{
7 Transports supported by \pkg{nanonext}.
8
9 For an authoritative guide please refer to the online documentation for the
10 NNG library at \url{https://nng.nanomsg.org/man/}.
11 }
12 \section{Inproc}{
13
14
15 The inproc transport provides communication support between sockets within
16 the same process. This may be used as an alternative to slower transports
17 when data must be moved within the same process. This transport tries hard to
18 avoid copying data, and thus is very light-weight.
19
20 \strong{[URI, inproc://]} This transport uses URIs using the scheme inproc://,
21 followed by an arbitrary string of text, terminated by a NUL byte.
22 inproc://nanonext is a valid example URL.
23
24 \itemize{
25 \item Multiple URIs can be used within the same application, and they will
26 not interfere with one another.
27
28 \item Two applications may also use the same URI without interfering with
29 each other, and they will be unable to communicate with each other using
30 that URI.
31 }
32 }
33
34 \section{IPC}{
35
36
37 The IPC transport provides communication support between sockets within
38 different processes on the same host. For POSIX platforms, this is
39 implemented using UNIX domain sockets. For Windows, this is implemented using
40 Windows Named Pipes. Other platforms may have different implementation
41 strategies.
42
43 \emph{Traditional Names}
44
45 \strong{[URI, ipc://]} This transport uses URIs using the scheme ipc://,
46 followed by a path name in the file system where the socket or named pipe
47 should be created.
48
49 \itemize{
50 \item On POSIX platforms, the path is taken literally, and is relative to
51 the current directory, unless it begins with /, in which case it is
52 relative to the root directory. For example, ipc://nanonext refers to the
53 name nanonext in the current directory, whereas ipc:///tmp/nanonext refers
54 to nanonext located in /tmp.
55 \item On Windows, all names are prefixed by \\.\ pipe\ and do not reside in
56 the normal file system - the required prefix is added automatically by NNG,
57 so a URL of the form ipc://nanonext is fine.
58 }
59
60 \emph{UNIX Aliases}
61
62 \strong{[URI, unix://]} The unix:// scheme is an alias for ipc:// and can be
63 used inter-changeably, but only on POSIX systems. The purpose of this scheme
64 is to support a future transport making use of AF_UNIX on Windows systems, at
65 which time it will be necessary to discriminate between the Named Pipes and
66 the AF_UNIX based transports.
67
68 \emph{Abstract Names}
69
70 \strong{[URI, abstract://]} On Linux, this transport also can support abstract
71 sockets. Abstract sockets use a URI-encoded name after the scheme, which
72 allows arbitrary values to be conveyed in the path, including embedded NUL
73 bytes. abstract://nanonext is a valid example URL.
74
75 \itemize{
76 \item Abstract sockets do not have any representation in the file system,
77 and are automatically freed by the system when no longer in use. Abstract
78 sockets ignore socket permissions, but it is still possible to determine
79 the credentials of the peer.
80 }
81 }
82
83 \section{TCP/IP}{
84
85
86 The TCP transport provides communication support between sockets across a
87 TCP/IP network. Both IPv4 and IPv6 are supported when supported by the
88 underlying platform.
89
90 \strong{[URI, tcp://]} This transport uses URIs using the scheme tcp://,
91 followed by an IP address or hostname, followed by a colon and finally a TCP
92 port number. For example, to contact port 80 on the localhost either of the
93 following URIs could be used: tcp://127.0.0.1:80 or tcp://localhost:80.
94
95 \itemize{
96 \item A URI may be restricted to IPv6 using the scheme tcp6://, and may be
97 restricted to IPv4 using the scheme tcp4://
98
99 \item Note: Specifying tcp6:// may not prevent IPv4 hosts from being used
100 with IPv4-in-IPv6 addresses, particularly when using a wildcard hostname
101 with listeners. The details of this varies across operating systems.
102
103 \item Note: both tcp6:// and tcp4:// are specific to NNG, and might not be
104 understood by other implementations.
105
106 \item It is recommended to use either numeric IP addresses, or names that
107 are specific to either IPv4 or IPv6 to prevent confusion and surprises.
108
109 \item When specifying IPv6 addresses, the address must be enclosed in
110 square brackets ([]) to avoid confusion with the final colon separating
111 the port. For example, the same port 80 on the IPv6 loopback address (::1)
112 would be specified as tcp://[::1]:80.
113
114 \item The special value of 0 (INADDR_ANY) can be used for a listener to
115 indicate that it should listen on all interfaces on the host. A shorthand
116 for this form is to either omit the address, or specify the asterisk (\emph{)
117 character. For example, the following three URIs are all equivalent, and
118 could be used to listen to port 9999 on the host: (1) tcp://0.0.0.0:9999
119 (2) tcp://}:9999 (3) tcp://:9999
120 }
121 }
122
123 \section{TLS}{
124
125
126 The TLS transport provides communication support between peers across a
127 TCP/IP network using TLS v1.2 on top of TCP. Both IPv4 and IPv6 are supported
128 when supported by the underlying platform.
129
130 \strong{[URI, tls+tcp://]} This transport uses URIs using the scheme tls+tcp://,
131 followed by an IP address or hostname, followed by a colon and finally a TCP
132 port number. For example, to contact port 4433 on the localhost either of the
133 following URIs could be used: tls+tcp://127.0.0.1:4433 or
134 tls+tcp://localhost:4433.
135 \itemize{
136 \item A URI may be restricted to IPv6 using the scheme tls+tcp6://, or IPv4
137 using the scheme tls+tcp4://.
138 }
139 }
140
141 \section{WebSocket}{
142
143
144 The ws and wss transport provides communication support between peers across
145 a TCP/IP network using WebSockets. Both IPv4 and IPv6 are supported when
146 supported by the underlying platform.
147
148 \strong{[URI, ws://]} This transport uses URIs using the scheme ws://, followed
149 by an IP address or hostname, optionally followed by a colon and a TCP port
150 number, optionally followed by a path. (If no port number is specified then
151 port 80 is assumed. If no path is specified then a path of / is assumed.) For
152 example, the URI ws://localhost/app/pubsub would use port 80 on localhost,
153 with the path /app/pubsub.
154
155 \strong{[URI, wss://]} Secure WebSockets use the scheme wss://, and the default
156 TCP port number of 443. Otherwise the format is the same as for regular
157 WebSockets.
158
159 \itemize{
160 \item A URI may be restricted to IPv6 using the scheme ws6:// or wss6://,
161 or IPv4 using the scheme ws4:// or wss4://.
162
163 \item When specifying IPv6 addresses, the address must be enclosed in
164 square brackets ([]) to avoid confusion with the final colon separating
165 the port. For example, the same path and port on the IPv6 loopback address
166 (::1) would be specified as ws://[::1]/app/pubsub.
167
168 \item Note: The value specified as the host, if any, will also be used in
169 the Host: HTTP header during HTTP negotiation.
170
171 \item To listen to all ports on the system, the host name may be elided
172 from the URL on the listener. This will wind up listening to all interfaces
173 on the system, with possible caveats for IPv4 and IPv6 depending on what
174 the underlying system supports. (On most modern systems it will map to the
175 special IPv6 address ::, and both IPv4 and IPv6 connections will be
176 permitted, with IPv4 addresses mapped to IPv6 addresses.)
177
178 \item This transport makes use of shared HTTP server instances, permitting
179 multiple sockets or listeners to be configured with the same hostname and
180 port. When creating a new listener, it is registered with an existing HTTP
181 server instance if one can be found. Note that the matching algorithm is
182 somewhat simple, using only a string based hostname or IP address and port
183 to match. Therefore it is recommended to use only IP addresses or the empty
184 string as the hostname in listener URLs.
185
186 \item All sharing of server instances is only typically possible within the
187 same process.
188
189 \item The server may also be used by other things (for example to serve
190 static content), in the same process.
191 }
192 }
193