Пример #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());
  }
Пример #2
0
 /**
  * Checks if the socket is connected
  *
  * @since 1.4
  */
 public boolean isConnected() {
   return impl.getInetAddress() != null;
 }
Пример #3
0
  /**
   * Returns the address of the remote end of the socket. If this socket is not connected, then
   * <code>null</code> is returned.
   *
   * @return The remote address this socket is connected to
   */
  public InetAddress getInetAddress() {
    if (impl != null) return impl.getInetAddress();

    return null;
  }