blob: ee7eb99b63e6f11513825394289130df20ff8542 (
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
|
## nng_stream_dialer_dial
Initiate outgoing byte stream connection.
### Synopsis
```c
#include <nng/nng.h>
void nng_stream_dialer_dial(nng_stream_dialer *d, nng_aio *aio);
```
### Description
The `nng_stream_dialer_dial` attempts to establish a connection to the remote peer for the dialer _d_.
The operation is completed asynchronously, using _aio_.
TIP: The peer address is determined by the address specified using xref:nng_stream_dialer_alloc.adoc[`nng_stream_dialer_alloc`] or xref:nng_stream_dialer_alloc.adoc[`nng_stream_dialer_alloc_url`].
If a connection is successfully established, the _aio_ will have the resulting `nng_stream` object stored as its first output.
(See xref:../aio/nng_aio_get_output.adoc[`nng_aio_get_output`].)
### Errors
[horizontal]
`NNG_EADDRINVAL`:: The address specified is invalid.
`NNG_ECANCELED`:: The operation was aborted.
`NNG_ECLOSED`:: The dialer is closed.
`NNG_ECONNREFUSED`:: The connection was refused by the server.
`NNG_ECONNRESET`:: The connection was reset by the server.
`NNG_ENOMEM`:: Insufficient free memory exists.
### See Also
xref:../aio/index.adoc[Asynchronous I/O],
xref:nng_stream_dialer_alloc.adoc[nng_stream_dialer_alloc],
xref:nng_stream_dialer_close.adoc[nng_stream_dialer_close]
|