%SS2_GETSOCKNAME

Return the name associated with a socket (IPv6)

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

Return value

status

Returns SS_SUCCESS (0) or one of the errors in Error codes returned by %SS2_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_addr6

Returned with the IPv6 address of the socket. ([#]byte)

Discussion

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

If a socket was bound with the in_addr6 argument set to 0, indicating that any of the host’s IP addresses may be used for the socket (see the note for %SS2_BIND), %SS2_GETSOCKNAME does not necessarily return information about the host IP address, unless there has been a call to %SS2_CONNECT or %SS2_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 %SS2_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