%SS_GETSOCKNAME

Return the name associated with a socket (IPv4)

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
status = %SS_GETSOCKNAME(socket, in_port, in_addr)

Return value

status

Returns SS_SUCCESS (0) or one of the errors in Error codes returned by %SS_GETSOCKNAME below. (n)

Arguments

socket

A descriptor of an open socket created by %SS_SOCKET. (i4)

in_port

Returned with the internet port of the socket. (i4)

in_addr

Returned with the IPv4 address of the socket. (i4)

Discussion

%SS_GETSOCKNAME returns the name of a socket, which is the local association. This function can be useful when an %SS_CONNECT call has been made without doing an %SS_BIND first; this call provides the only method of determining the local association set by the system.

If a socket was bound with SS_INADDR_ANY, indicating that any of the host’s IP addresses should be used for the socket, %SS_GETSOCKNAME does not necessarily return information about the host IP address, unless there has been a call to %SS_CONNECT or %SS_ACCEPT. This is because on a multihomed host, the IP address that will be used for the socket is unknown unless the socket is connected.

Error codes returned by %SS_GETSOCKNAME

See the Socket Errors table for additional information about these errors.

SS_EBADF

SS_EINVAL

SS_ENOBUFS

SS_ENOMEM

SS_ENOTSOCK

SS_EUNKNOWN

SS_NOTINITIALISED