コード例 #1
0
ファイル: Socket.java プロジェクト: janfj/dd-wrt
  /**
   * 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());
  }
コード例 #2
0
ファイル: Socket.java プロジェクト: janfj/dd-wrt
  /**
   * 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;
  }