diff options
| author | Garrett D'Amore <garrett@damore.org> | 2025-04-14 00:03:47 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2025-04-19 20:42:59 -0700 |
| commit | df3059dd130ce22f2326abeb41149bdf35e0c38d (patch) | |
| tree | 83ce0a27ac4a29f058977e378cc9f321e5995ef7 /src/core | |
| parent | 55925438bc8b8fd243ab995c48c8996ac49a6652 (diff) | |
| download | nng-gdamore/udpconn.tar.gz nng-gdamore/udpconn.tar.bz2 nng-gdamore/udpconn.zip | |
UDP: Add support for connected mode UDP sockets.gdamore/udpconn
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/platform.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/core/platform.h b/src/core/platform.h index bdb8beb4..3658020c 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -353,11 +353,15 @@ extern int nni_ipc_listener_alloc(nng_stream_listener **, const nng_url *); // typedef struct nni_plat_udp nni_plat_udp; -// nni_plat_udp_open initializes a UDP socket, binding to the local -// address specified in the AIO. The remote address is -// not used. The resulting nni_plat_udp structure is returned in the -// aio's a_pipe. -extern int nni_plat_udp_open(nni_plat_udp **, nni_sockaddr *); +// nni_plat_udp_open initializes a UDP socket, binding to the specified local +// address. +extern int nni_plat_udp_open(nni_plat_udp **udpp, nni_sockaddr *self); + +// nni_plat_udp_connected initializes a connected UDP socket, binding to the +// local address specified in the AIO, and connecting to the remote one. +// This is a non-blocking operation. +extern int nni_plat_udp_connect( + nni_plat_udp **udpp, nni_sockaddr *self, nni_sockaddr *peer); // nni_plat_udp_close closes the underlying UDP socket. extern void nni_plat_udp_close(nni_plat_udp *); @@ -405,6 +409,7 @@ extern void nni_plat_pipe_clear(int); extern void nni_plat_pipe_close(int, int); extern int nni_plat_udp_sockname(nni_plat_udp *, nni_sockaddr *); +extern int nni_plat_udp_peername(nni_plat_udp *, nni_sockaddr *); // nni_socket_pair is used to create a socket pair using socketpair() // on POSIX systems. (Windows might provide a similar solution, using |
