public int getPort ()

Returns the remote port number to which this socket is connected.

If the socket was connected prior to being closed, then this method will continue to return the connected port number after the socket is closed.

Returns:  the remote port number to which this socket is connected, or 0 if the socket is not connected yet.