Class UnixServerSocket

java.lang.Object
cx.ath.matthew.unix.UnixServerSocket

public class UnixServerSocket extends Object
Represents a listening UNIX Socket.
  • Constructor Details

    • UnixServerSocket

      public UnixServerSocket()
      Create an un-bound server socket.
    • UnixServerSocket

      public UnixServerSocket(UnixSocketAddress address) throws IOException
      Create a server socket bound to the given address.
      Parameters:
      address - Path to the socket.
      Throws:
      IOException
    • UnixServerSocket

      public UnixServerSocket(String address) throws IOException
      Create a server socket bound to the given address.
      Parameters:
      address - Path to the socket.
      Throws:
      IOException
  • Method Details

    • accept

      public UnixSocket accept() throws IOException
      Accepts a connection on the ServerSocket.
      Returns:
      A UnixSocket connected to the accepted connection.
      Throws:
      IOException
    • close

      public void close() throws IOException
      Closes the ServerSocket.
      Throws:
      IOException
    • bind

      public void bind(UnixSocketAddress address) throws IOException
      Binds a server socket to the given address.
      Parameters:
      address - Path to the socket.
      Throws:
      IOException
    • bind

      public void bind(String address) throws IOException
      Binds a server socket to the given address.
      Parameters:
      address - Path to the socket.
      Throws:
      IOException
    • getAddress

      public UnixSocketAddress getAddress()
      Return the address this socket is bound to.
      Returns:
      The UnixSocketAddress if bound or null if unbound.
    • isClosed

      public boolean isClosed()
      Check the status of the socket.
      Returns:
      True if closed.
    • isBound

      public boolean isBound()
      Check the status of the socket.
      Returns:
      True if bound.