git-subtree-dir: external/nng git-subtree-split: 29b73962b939a6fbbf6ea8d5d7680bb06d0eeb99
80 lines
2.7 KiB
Text
80 lines
2.7 KiB
Text
= nng_dialer(5)
|
|
//
|
|
// 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_dialer - dialer
|
|
|
|
== SYNOPSIS
|
|
|
|
[source, c]
|
|
----
|
|
#include <nng/nng.h>
|
|
|
|
typedef struct nng_dialer_s nng_dialer;
|
|
----
|
|
|
|
== DESCRIPTION
|
|
|
|
(((dialer)))
|
|
An `nng_dialer` is a handle to a dialer object, which is responsible for
|
|
creating a single xref:nng_pipe.5.adoc[`nng_pipe`] at a time by
|
|
establishing an outgoing connection.
|
|
|
|
If the connection is broken, or fails, the dialer object will automatically
|
|
attempt to reconnect, and will keep doing so until the dialer or socket is
|
|
destroyed.
|
|
|
|
Dialer objects are created by the
|
|
xref:nng_dialer_create.3.adoc[`nng_dialer_create()`]
|
|
or xref:nng_dial.3.adoc[`nng_dial()`] functions, and are always associated
|
|
with a single xref:nng_socket.5.adoc[`nng_socket`].
|
|
|
|
IMPORTANT: The `nng_dialer` structure is always passed by value (both
|
|
for input parameters and return values), and should be treated opaquely.
|
|
Passing structures this way gives the compiler a chance to perform
|
|
accurate type checks in functions passing values of this type.
|
|
|
|
TIP: A given xref:nng_socket.5.adoc[`nng_socket`] may have multiple dialer
|
|
objects, multiple xref:nng_listener.5.adoc[listener] objects, or even some
|
|
of both.
|
|
|
|
TIP: The client/server relationship described by dialer/listener is
|
|
completely orthogonal to any similar relationship in the protocols.
|
|
For example, a xref:nng_rep.7.adoc[_rep_] socket may use a dialer
|
|
to connect to a listener on an xref:nng_req.7.adoc[_req_] socket.
|
|
This orthogonality can lead to innovative solutions to otherwise
|
|
challenging communications problems.
|
|
|
|
Dialer objects may be destroyed by the
|
|
xref:nng_dialer_close.3.adoc[`nng_dialer_close()`] function.
|
|
They are also closed when their associated socket is closed.
|
|
|
|
[[NNG_DIALER_INITIALIZER]]
|
|
=== Initialization
|
|
|
|
A dialer may be initialized using the macro `NNG_DIALER_INITIALIZER`
|
|
before it is opened, to prevent confusion with valid open dialers.
|
|
|
|
== SEE ALSO
|
|
|
|
[.text-left]
|
|
xref:nng_dial.3.adoc[nng_dial(3)],
|
|
xref:nng_dialer_close.3.adoc[nng_dialer_close(3)],
|
|
xref:nng_dialer_create.3.adoc[nng_dialer_create(3)],
|
|
xref:nng_dialer_getopt.3.adoc[nng_dialer_getopt(3)],
|
|
xref:nng_dialer_id.3.adoc[nng_dialer_id(3)],
|
|
xref:nng_dialer_setopt.3.adoc[nng_dialer_setopt(3)],
|
|
xref:nng_dialer_start.3.adoc[nng_dialer_start(3)],
|
|
xref:nng_listener.5.adoc[nng_listener(5)],
|
|
xref:nng_pipe.5.adoc[nng_pipe(5)],
|
|
xref:nng_socket.5.adoc[nng_socket(5)],
|
|
xref:nng.7.adoc[nng(7)]
|