From cc419cf01d9c060a3bd3fc318f9b9bc9e736dae9 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 25 Oct 2025 11:43:59 -0700 Subject: Add stream direct address functions for socket addresses. This is going to be used to facilitate debugging, and eliminate some inconveniences around these things. We plan to move the pipe functions to use these directly, hopefully moving away from the pipe_getopt hack. (The transport API will need to grow these. For now this is just the streams.) --- docs/ref/api/stream.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'docs/ref/api/stream.md') diff --git a/docs/ref/api/stream.md b/docs/ref/api/stream.md index 38c6adb8..6b02d8db 100644 --- a/docs/ref/api/stream.md +++ b/docs/ref/api/stream.md @@ -76,6 +76,18 @@ stream itself. > or be aborted, these functions are unsafe to call from functions that may not block, such as the > completion function registered with an [`nng_aio`] when it is created. +## Stream Addresses + +```c +nng_err nng_stream_peer_addr(nng_stream *s, const nng_sockaddr **valp); +nng_err nng_stream_self_addr(nng_stream *s, const nng_sockaddr **valp); +``` + +{{hi:`nng_stream_peer_addr`}} +{{hi:`nng_stream_self_addr`}} +These functions are used to obtain value of the local (self) or remote (peer) addresses +for the given stream _s_. + ## Getting Stream Options ```c @@ -102,6 +114,10 @@ are available, and which type they may be accessed using. In the case of `nng_stream_get_string`, the string pointer is only guaranteed to be valid while the stream exists. Callers should make a copy of the data if required before closing the stream. +> [!NOTE]: +> The `nng_stream_get_addr` function is deprecated and will be removed. Use the +> [`nng_stream_peer_addr`] or [`nng_stream_self_addr`] functions instead. + ## Stream Factories ```c -- cgit v1.2.3-70-g09d2