Package naga

Interface NIOAbstractSocket

All Known Subinterfaces:
NIOServerSocket, NIOServerSocketSSL, NIOSocket, NIOSocketSSL

public interface NIOAbstractSocket
An interface describing methods common to both NIOSocket and NIOServerSocket.
Author:
Christoffer Lerno
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes this socket (the actual disconnect will occur on the NIOService thread)
    Returns the InetSocketAddress for this socket.
    Reports the IP used by this socket.
    int
    Returns the port in use by this socket.
    Returns the tag for this socket.
    boolean
    Returns the current state of this socket.
    void
    Returns the tag for this socket.
  • Method Details

    • close

      void close()
      Closes this socket (the actual disconnect will occur on the NIOService thread)

      This method is thread-safe.

    • getAddress

      InetSocketAddress getAddress()
      Returns the InetSocketAddress for this socket.

      This method is thread-safe.

      Returns:
      the InetSocketAddress this socket connects to.
    • isOpen

      boolean isOpen()
      Returns the current state of this socket.

      This method is thread-safe.

      Returns:
      true if the connection is socket is open, false if closed.
    • getIp

      String getIp()
      Reports the IP used by this socket.

      This method is thread-safe.

      Returns:
      the IP of this socket.
    • getPort

      int getPort()
      Returns the port in use by this socket.

      This method is thread-safe.

      Returns:
      the port of this socket.
    • getTag

      Object getTag()
      Returns the tag for this socket.
      Returns:
      the tag or null if no tag has been set.
    • setTag

      void setTag(Object tag)
      Returns the tag for this socket. A tag is an object that you can associate with the socket and retrieve later.
      Parameters:
      tag - the new tag for this socket.