Ejemplo n.º 1
0
  /**
   * If the socket is already connected this returns the remote SocketAddress, otherwise null
   *
   * @since 1.4
   */
  public SocketAddress getRemoteSocketAddress() {
    if (!isConnected()) return null;

    return new InetSocketAddress(impl.getInetAddress(), impl.getPort());
  }
Ejemplo n.º 2
0
  /**
   * Returns the port number of the remote end of the socket connection. If this socket is not
   * connected, then -1 is returned.
   *
   * @return The remote port this socket is connected to
   */
  public int getPort() {
    if (impl != null) return impl.getPort();

    return -1;
  }