1919# ' Open Socket
2020# '
2121# ' Open a Socket implementing \sQuote{protocol}, and optionally dial (establish
22- # ' an outgoing connection) or listen (accept an incoming connection) at an
23- # ' address.
22+ # ' an outgoing connection) or listen (accept an incoming connection) at an
23+ # ' address.
24+ # '
25+ # ' NNG presents a socket view of networking. The sockets are constructed using
26+ # ' protocol-specific functions, as a given socket implements precisely one
27+ # ' protocol.
28+ # '
29+ # ' Each socket may be used to send and receive messages (if the protocol
30+ # ' supports it, and implements the appropriate protocol semantics). For example,
31+ # ' sub sockets automatically filter incoming messages to discard those for
32+ # ' topics that have not been subscribed.
33+ # '
34+ # ' This function (optionally) binds a single Dialer and/or Listener to a Socket.
35+ # ' More complex network topologies may be created by binding further Dialers /
36+ # ' Listeners to the Socket as required using \code{\link{dial}} and
37+ # ' \code{\link{listen}}.
38+ # '
39+ # ' New contexts may also be created using \code{\link{context}} if the protocol
40+ # ' supports it.
2441# '
2542# ' @param protocol [default 'bus'] choose protocol - \sQuote{bus}, \sQuote{pair},
26- # ' \sQuote{poly}, \sQuote{push}, \sQuote{pull}, \sQuote{pub}, \sQuote{sub},
27- # ' \sQuote{req}, \sQuote{rep}, \sQuote{surveyor}, or \sQuote{respondent} -
28- # ' see \link{protocols}.
43+ # ' \sQuote{poly}, \sQuote{push}, \sQuote{pull}, \sQuote{pub}, \sQuote{sub},
44+ # ' \sQuote{req}, \sQuote{rep}, \sQuote{surveyor}, or \sQuote{respondent} - see
45+ # ' \link{protocols}.
2946# ' @param dial (optional) a URL to dial, specifying the transport and address as
30- # ' a character string e.g. 'inproc://anyvalue' or 'tcp://127.0.0.1:5555'
31- # ' (see \link{transports}).
47+ # ' a character string e.g. 'inproc://anyvalue' or 'tcp://127.0.0.1:5555' (see
48+ # ' \link{transports}).
3249# ' @param listen (optional) a URL to listen at, specifying the transport and
33- # ' address as a character string e.g. 'inproc://anyvalue' or
34- # ' 'tcp://127.0.0.1:5555' (see \link{transports}).
50+ # ' address as a character string e.g. 'inproc://anyvalue' or
51+ # ' 'tcp://127.0.0.1:5555' (see \link{transports}).
3552# ' @param autostart [default TRUE] whether to start the dialer/listener. Set to
36- # ' FALSE if setting configuration options on the dialer/listener as it is
37- # ' not generally possible to change these once started. For dialers only:
38- # ' set to NA to start synchronously - this is less resilient if a
39- # ' connection is not immediately possible, but avoids subtle errors from
40- # ' attempting to use the socket before an asynchronous dial has completed.
53+ # ' FALSE if setting configuration options on the dialer/listener as it is not
54+ # ' generally possible to change these once started. For dialers only: set to
55+ # ' NA to start synchronously - this is less resilient if a connection is not
56+ # ' immediately possible, but avoids subtle errors from attempting to use the
57+ # ' socket before an asynchronous dial has completed.
4158# ' @param raw [default FALSE] whether to open raw mode sockets. Note: not for
42- # ' general use - do not enable unless you have a specific need (refer to NNG
43- # ' documentation).
59+ # ' general use - do not enable unless you have a specific need (refer to NNG
60+ # ' documentation).
4461# ' @inheritParams dial
4562# '
4663# ' @return A Socket (object of class \sQuote{nanoSocket} and \sQuote{nano}).
4764# '
48- # ' @details NNG presents a socket view of networking. The sockets are
49- # ' constructed using protocol-specific functions, as a given socket
50- # ' implements precisely one protocol.
51- # '
52- # ' Each socket may be used to send and receive messages (if the protocol
53- # ' supports it, and implements the appropriate protocol semantics). For
54- # ' example, sub sockets automatically filter incoming messages to discard
55- # ' those for topics that have not been subscribed.
56- # '
57- # ' This function (optionally) binds a single Dialer and/or Listener to a
58- # ' Socket. More complex network topologies may be created by binding further
59- # ' Dialers/Listeners to the Socket as required using \code{\link{dial}} and
60- # ' \code{\link{listen}}.
61- # '
62- # ' New contexts may also be created using \code{\link{context}} if the
63- # ' protocol supports it.
64- # '
6565# ' @section Protocols:
6666# '
67- # ' The following Scalability Protocols (communication patterns) are
68- # ' implemented:
69- # ' \itemize{
70- # ' \item Bus (mesh networks) - protocol: 'bus'
71- # ' \item Pair (two-way radio) - protocol: 'pair'
72- # ' \item Poly (one-to-one of many) - protocol: 'poly'
73- # ' \item Pipeline (one-way pipe) - protocol: 'push', 'pull'
74- # ' \item Publisher/Subscriber (topics & broadcast) - protocol: 'pub', 'sub'
75- # ' \item Request/Reply (RPC) - protocol: 'req', 'rep'
76- # ' \item Survey (voting & service discovery) - protocol: 'surveyor',
77- # ' 'respondent'
78- # ' }
79- # '
80- # ' Please see \link{protocols} for further documentation.
67+ # ' The following Scalability Protocols (communication patterns) are implemented:
68+ # ' \itemize{
69+ # ' \item Bus (mesh networks) - protocol: 'bus'
70+ # ' \item Pair (two-way radio) - protocol: 'pair'
71+ # ' \item Poly (one-to-one of many) - protocol: 'poly'
72+ # ' \item Pipeline (one-way pipe) - protocol: 'push', 'pull'
73+ # ' \item Publisher/Subscriber (topics & broadcast) - protocol: 'pub', 'sub'
74+ # ' \item Request/Reply (RPC) - protocol: 'req', 'rep'
75+ # ' \item Survey (voting & service discovery) - protocol: 'surveyor',
76+ # ' 'respondent'
77+ # ' }
78+ # '
79+ # ' Please see \link{protocols} for further documentation.
8180# '
8281# ' @section Transports:
8382# '
84- # ' The following communications transports may be used:
85- # ' \itemize{
86- # ' \item Inproc (in-process) - url: 'inproc://'
87- # ' \item IPC (inter-process communications) - url: 'ipc://' (or
88- # ' 'abstract://' on Linux)
89- # ' \item TCP and TLS over TCP - url: 'tcp://' and 'tls+tcp://'
90- # ' \item WebSocket and TLS over WebSocket - url: 'ws://' and 'wss://'
91- # ' }
83+ # ' The following communications transports may be used:
84+ # '
85+ # ' \itemize{
86+ # ' \item Inproc (in-process) - url: 'inproc://'
87+ # ' \item IPC (inter-process communications) - url: 'ipc://' (or 'abstract://'
88+ # ' on Linux)
89+ # ' \item TCP and TLS over TCP - url: 'tcp://' and 'tls+tcp://'
90+ # ' \item WebSocket and TLS over WebSocket - url: 'ws://' and 'wss://'
91+ # ' }
9292# '
93- # ' Please see \link{transports} for further documentation.
93+ # ' Please see \link{transports} for further documentation.
9494# '
9595# ' @examples
9696# ' s <- socket(protocol = "req", listen = "inproc://nanosocket")
@@ -118,15 +118,15 @@ socket <- function(protocol = c("bus", "pair", "poly", "push", "pull", "pub",
118118# ' Collect the Pipe from an Aio
119119# '
120120# ' This function retrieves the Pipe used to receive a message from the Aio. It
121- # ' will block if the Aio has yet to complete. The message is still available
122- # ' for retrieval by the usual means. A Pipe is a low-level object and it is
123- # ' not normally necessary to deal with them directly.
121+ # ' will block if the Aio has yet to complete. The message is still available for
122+ # ' retrieval by the usual means. A Pipe is a low-level object and it is not
123+ # ' normally necessary to deal with them directly.
124124# '
125- # ' @param x a 'recvAio' object.
125+ # ' As Pipes are always owned by a Socket, removing (and garbage collecting) a
126+ # ' Pipe does not close it or free its resources. A Pipe may, however, be
127+ # ' explicitly closed.
126128# '
127- # ' @details As Pipes are always owned by a Socket, removing (and garbage
128- # ' collecting) a Pipe does not close it or free its resources. A Pipe may,
129- # ' however, be explicitly closed.
129+ # ' @param x a 'recvAio' object.
130130# '
131131# ' @return A Pipe (object of class \sQuote{nanoPipe}).
132132# '
@@ -152,38 +152,37 @@ collect_pipe <- function(x) .Call(rnng_aio_collect_pipe, x)
152152# ' Close Connection
153153# '
154154# ' Close Connection on a Socket, Context, Dialer, Listener, Stream, Pipe, or
155- # ' ncurl Session.
155+ # ' ncurl Session.
156156# '
157- # ' @param con a Socket, Context, Dialer, Listener, Stream, Pipe, or
158- # ' \sQuote{ncurlSession}.
159- # ' @param ... not used .
157+ # ' Closing an object explicitly frees its resources. An object can also be
158+ # ' removed directly in which case its resources are freed when the object is
159+ # ' garbage collected .
160160# '
161- # ' @return Invisibly, an integer exit code (zero on success) .
161+ # ' Closing a Socket associated with a Context also closes the Context .
162162# '
163- # ' @details Closing an object explicitly frees its resources. An object can also
164- # ' be removed directly in which case its resources are freed when the object
165- # ' is garbage collected.
163+ # ' Dialers and Listeners are implicitly closed when the Socket they are
164+ # ' associated with is closed.
166165# '
167- # ' Closing a Socket associated with a Context also closes the Context.
166+ # ' Closing a Socket or a Context: messages that have been submitted for sending
167+ # ' may be flushed or delivered, depending upon the transport. Closing the Socket
168+ # ' while data is in transmission will likely lead to loss of that data. There is
169+ # ' no automatic linger or flush to ensure that the Socket send buffers have
170+ # ' completely transmitted.
168171# '
169- # ' Dialers and Listeners are implicitly closed when the Socket they are
170- # ' associated with is closed.
172+ # ' Closing a Stream: if any send or receive operations are pending, they will be
173+ # ' terminated and any new operations will fail after the connection is closed.
171174# '
172- # ' Closing a Socket or a Context: messages that have been submitted for
173- # ' sending may be flushed or delivered, depending upon the transport. Closing
174- # ' the Socket while data is in transmission will likely lead to loss of that
175- # ' data. There is no automatic linger or flush to ensure that the Socket
176- # ' send buffers have completely transmitted.
175+ # ' Closing an \sQuote{ncurlSession} closes the http(s) connection.
177176# '
178- # ' Closing a Stream: if any send or receive operations are pending, they
179- # ' will be terminated and any new operations will fail after the connection
180- # ' is closed.
177+ # ' As Pipes are owned by the corresponding Socket, removing (and garbage
178+ # ' collecting) a Pipe does not close it or free its resources. A Pipe may,
179+ # ' however, be explicitly closed.
181180# '
182- # ' Closing an \sQuote{ncurlSession} closes the http(s) connection.
181+ # ' @param con a Socket, Context, Dialer, Listener, Stream, Pipe, or
182+ # ' \sQuote{ncurlSession}.
183+ # ' @param ... not used.
183184# '
184- # ' As Pipes are owned by the corresponding Socket, removing (and garbage
185- # ' collecting) a Pipe does not close it or free its resources. A Pipe may,
186- # ' however, be explicitly closed.
185+ # ' @return Invisibly, an integer exit code (zero on success).
187186# '
188187# ' @seealso \code{\link{reap}}
189188# '
@@ -207,16 +206,16 @@ close.nanoPipe <- function(con, ...) invisible(.Call(rnng_pipe_close, con))
207206# ' Reap
208207# '
209208# ' An alternative to \code{close} for Sockets, Contexts, Listeners, Dialers and
210- # ' Pipes avoiding S3 method dispatch.
209+ # ' Pipes avoiding S3 method dispatch.
210+ # '
211+ # ' May be used on unclassed external pointers e.g. those created by
212+ # ' \code{\link{.context}}. Returns silently and does not warn or error, nor does
213+ # ' it update the state of object attributes.
211214# '
212215# ' @param con a Socket, Context, Listener, Dialer or Pipe.
213216# '
214217# ' @return An integer exit code (zero on success).
215218# '
216- # ' @details May be used on unclassed external pointers e.g. those created by
217- # ' \code{\link{.context}}. Returns silently and does not warn or error, nor
218- # ' does it update the state of object attributes.
219- # '
220219# ' @seealso \code{\link{close}}
221220# '
222221# ' @examples
0 commit comments