Method NetUtils.port_of()
- Method
port_of
string
port_of(RemoteAddressObject
|string
|int(0)
inc
,bool
|void
local_address
,string
|void
def
)- Description
Similar to ip_of but instead of IP returns port number.
If the argument is an object with a
query_address
method, return the port# part of the string returned by calling that function withlocal_address
as the argument.This means that for Stdio.File objects the remote address is returned by default, but if
local_address
is true the local address is returned.If the argument is a string instead, the part of the string after the first space is returned.
If the argument is 0 the default
def
value is returned, UNDEFINED unless specified.If
def
is supplied, it is used both when query_address() fails or something that is not a file descriptor object or a string is passed as the argument to this function.