Class AFUNIXServerSocket

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class AFUNIXServerSocket
    extends java.net.ServerSocket
    The server part of an AF_UNIX domain socket.
    Author:
    Christian Kohlschütter
    • Constructor Detail

      • AFUNIXServerSocket

        protected AFUNIXServerSocket()
                              throws java.io.IOException
        Constructs a new, unconnected instance.
        Throws:
        java.io.IOException - if the operation fails.
    • Method Detail

      • newInstance

        public static AFUNIXServerSocket newInstance()
                                              throws java.io.IOException
        Returns a new, unbound AF_UNIX ServerSocket.
        Returns:
        The new, unbound AFUNIXServerSocket.
        Throws:
        java.io.IOException - if the operation fails.
      • forceBindOn

        public static AFUNIXServerSocket forceBindOn​(AFUNIXSocketAddress forceAddr)
                                              throws java.io.IOException
        Returns a new, unbound AF_UNIX ServerSocket that will always bind to the given address, regardless of any socket address used in a call to bind.
        Parameters:
        forceAddr - The address to use.
        Returns:
        The new, yet unbound AFUNIXServerSocket.
        Throws:
        java.io.IOException - if an exception occurs.
      • bind

        public void bind​(java.net.SocketAddress endpoint,
                         int backlog)
                  throws java.io.IOException
        Overrides:
        bind in class java.net.ServerSocket
        Throws:
        java.io.IOException
      • isBound

        public boolean isBound()
        Overrides:
        isBound in class java.net.ServerSocket
      • isClosed

        public boolean isClosed()
        Overrides:
        isClosed in class java.net.ServerSocket
      • accept

        public AFUNIXSocket accept()
                            throws java.io.IOException
        Overrides:
        accept in class java.net.ServerSocket
        Throws:
        java.io.IOException
      • newSocketInstance

        protected AFUNIXSocket newSocketInstance()
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.net.ServerSocket
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.net.ServerSocket
        Throws:
        java.io.IOException
      • addCloseable

        public void addCloseable​(java.io.Closeable closeable)
        Registers a Closeable that should be closed when this socket is closed.
        Parameters:
        closeable - The closeable.
      • removeCloseable

        public void removeCloseable​(java.io.Closeable closeable)
        Unregisters a previously registered Closeable.
        Parameters:
        closeable - The closeable.
      • isSupported

        public static boolean isSupported()
        Checks whether everything is setup to support AF_UNIX sockets.
        Returns:
        true if supported.
      • getLocalSocketAddress

        public java.net.SocketAddress getLocalSocketAddress()
        Overrides:
        getLocalSocketAddress in class java.net.ServerSocket
      • getLocalPort

        public int getLocalPort()
        Overrides:
        getLocalPort in class java.net.ServerSocket