port

Retrieves the port number associated with this socket address.

If the SocketAddress instance is of type InetSocketAddress, the associated port is returned. Otherwise, an UnsupportedOperationException is thrown, as the provided address type does not support ports.

Return

the port number of the socket address if available.

Throws

if the socket address type does not support a port.


The port number of the current server.

Throws

if the local socket address does not support a port.