Pike v8.1 release 6

Method Stdio.Port()->query_address()


Method query_address

string query_address()

Description

Get the address and port of the local socket end-point.

Returns

This function returns the address and port of a socket end-point on the form "x.x.x.x port" (IPv4) or "x:x:x:x:x:x:x:x port" (IPv6).

If there is some error querying or formatting the address, 0 (zero) is returned and errno() will return the error code.

Throws

An error is thrown if the socket isn't bound.