aboutsummaryrefslogtreecommitdiff
path: root/docs/nng_dialer_start.adoc
blob: b6c6306dff0d5f25d593d1608c346b1315c36c6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
= nng_dialer_start(3)
:doctype: manpage
:manmanual: nng
:mansource: nng
:manvolnum: 3
:copyright: Copyright 2018 mailto:info@staysail.tech[Staysail Systems, Inc.] + \
            Copyright 2018 mailto:info@capitar.com[Capitar IT Group BV] + \
            {blank} + \
            This document is supplied under the terms of the \
            https://opensource.org/licenses/MIT[MIT License].

== NAME

nng_dialer_start - start dialer

== SYNOPSIS

[source, c]
-----------
#include <nng/nng.h>

int nng_dialer_start(nng_dialer d, int flags);
-----------

== DESCRIPTION

The `nng_dialer_start()` function starts the dialer _d_.

This causes the dialer to start connecting to the address with which it was
created.

When a connection is established, it results in a pipe being created,
which will be attached to the dialer's socket.

Normally, the first attempt to connect to the dialer's address is done
synchronously, including any necessary name resolution.  As a result,
a failure, such as if the connection is refused, will be returned
immediately, and no further action will be taken. 

However, if the special value `NNG_FLAG_NONBLOCK` is
supplied in _flags_, then the connection attempt is made asynchronously.

Furthermore, if the connection was closed for a synchronously dialed
connection, the dialer will still attempt to redial asynchronously.

TIP: While `NNG_FLAG_NONBLOCK` can help an application be more resilient,
it also generally makes diagnosing failures somewhat more difficult.

Once a dialer has started, it is generally not possible to change
it's configuration.

== RETURN VALUES

This function returns 0 on success, and non-zero otherwise.

== ERRORS

`NNG_EADDRINVAL`:: An invalid _url_ was specified.
`NNG_ECLOSED`:: The socket _s_ is not open.
`NNG_ECONNREFUSED`:: The remote peer refused the connection.
`NNG_ECONNRESET`:: The remote peer reset the connection.
`NNG_EINVAL`:: An invalid set of _flags_ was specified.
`NNG_ENOMEM`:: Insufficient memory is available.
`NNG_EPEERAUTH`:: Authentication or authorization failure.
`NNG_EPROTO`:: A protocol error occurred.
`NNG_ESTATE`:: The dialer _d_ is already started.
`NNG_EUNREACHABLE`:: The remote address is not reachable.

== SEE ALSO

<<nng_dial#,nng_dial(3)>>,
<<nng_dialer_create#,nng_dialer_create(3)>>
<<nng_strerror#,nng_strerror(3)>>,
<<nng#,nng(7)>>

== COPYRIGHT

{copyright}