ListenerLocalAddr
Description
Query the actually-bound local address of a listener. Useful after ListenerOpen with port 0, where the kernel picks the port. Wraps getsockname on POSIX / Winsock identically.
Parameters
| Name | Direction | Description |
|---|---|---|
self |
in | Open listener. |
out |
out | Filled with the bound address. Zeroed on failure. |
Success
returns true; out populated.
Failure
returns false; logs the failing syscall.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Socket.c:39:
// public API.
SocketAddr local;
if (!ListenerLocalAddr(&listener, &local)) {
ListenerClose(&listener);
DefaultAllocatorDeinit(&alloc);- In
Socket.c:920:
}
bool ListenerLocalAddr(const Listener *self, SocketAddr *out) {
if (!self || !out) {
LOG_ERROR("ListenerLocalAddr: NULL argument");- In
Socket.c:922:
bool ListenerLocalAddr(const Listener *self, SocketAddr *out) {
if (!self || !out) {
LOG_ERROR("ListenerLocalAddr: NULL argument");
return false;
}
Last updated on