[#Sock-GetSockName] = xref:Sock.adoc[Sock]::GetSockName :relfileprefix: ../ :mrdocs: getsockname(2) wrapper. Equivalent to `getsockname(m_socket, name, name_len)`. Code that uses this wrapper can be unit tested if this method is overridden by a mock Sock implementation. == Synopsis Declared in `<util/sock.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[nodiscard]] virtual int GetSockName( sockaddr* name, socklen_t* name_len) const; ---- == Return Value 0 on success, or ‐1 on error (with errno set). [NOTE] ==== The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^]. ==== == Parameters [cols="1,4"] |=== | Name| Description | *name* | Buffer that receives the local address of the socket. | *name_len* | On input the size of `name`, on output the actual address size. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#