Class AFVSOCKServerSocket

java.lang.Object
java.net.ServerSocket
org.newsclub.net.unix.AFServerSocket<org.newsclub.net.unix.AFVSOCKSocketAddress>
org.newsclub.net.unix.vsock.AFVSOCKServerSocket
All Implemented Interfaces:
Closeable, AutoCloseable, org.newsclub.net.unix.FileDescriptorAccess

public class AFVSOCKServerSocket extends org.newsclub.net.unix.AFServerSocket<org.newsclub.net.unix.AFVSOCKSocketAddress>
The server part of an AF_VSOCK socket.
Author:
Christian Kohlschütter
  • Method Details

    • newChannel

      protected org.newsclub.net.unix.AFServerSocketChannel<org.newsclub.net.unix.AFVSOCKSocketAddress> newChannel()
      Specified by:
      newChannel in class org.newsclub.net.unix.AFServerSocket<org.newsclub.net.unix.AFVSOCKSocketAddress>
    • getChannel

      public AFVSOCKServerSocketChannel getChannel()
      Overrides:
      getChannel in class org.newsclub.net.unix.AFServerSocket<org.newsclub.net.unix.AFVSOCKSocketAddress>
    • newInstance

      public static AFVSOCKServerSocket newInstance() throws IOException
      Returns a new, unbound AF_VSOCK ServerSocket.
      Returns:
      The new, unbound AFServerSocket.
      Throws:
      IOException - if the operation fails.
    • bindOn

      public static AFVSOCKServerSocket bindOn(org.newsclub.net.unix.AFVSOCKSocketAddress addr) throws IOException
      Returns a new AF_VSOCK ServerSocket that is bound to the given AFVSOCKSocketAddress.
      Parameters:
      addr - The socket file to bind to.
      Returns:
      The new, bound AFServerSocket.
      Throws:
      IOException - if the operation fails.
    • bindOn

      public static AFVSOCKServerSocket bindOn(org.newsclub.net.unix.AFVSOCKSocketAddress addr, boolean deleteOnClose) throws IOException
      Returns a new AF_VSOCK ServerSocket that is bound to the given AFSocketAddress.
      Parameters:
      addr - The socket file to bind to.
      deleteOnClose - If true, the socket file (if the address points to a file) will be deleted upon AFServerSocket.close().
      Returns:
      The new, bound AFServerSocket.
      Throws:
      IOException - if the operation fails.
    • forceBindOn

      public static AFVSOCKServerSocket forceBindOn(org.newsclub.net.unix.AFVSOCKSocketAddress forceAddr) throws IOException
      Returns a new, unbound AF_VSOCK 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 AFServerSocket.
      Throws:
      IOException - if an exception occurs.
    • newImpl

      protected org.newsclub.net.unix.vsock.AFVSOCKSocketImpl newImpl(FileDescriptor fdObj) throws SocketException
      Specified by:
      newImpl in class org.newsclub.net.unix.AFServerSocket<org.newsclub.net.unix.AFVSOCKSocketAddress>
      Throws:
      SocketException
    • newSocketInstance

      protected org.newsclub.net.unix.AFSocket<org.newsclub.net.unix.AFVSOCKSocketAddress> newSocketInstance() throws IOException
      Specified by:
      newSocketInstance in class org.newsclub.net.unix.AFServerSocket<org.newsclub.net.unix.AFVSOCKSocketAddress>
      Throws:
      IOException
    • accept

      public AFVSOCKSocket accept() throws IOException
      Overrides:
      accept in class org.newsclub.net.unix.AFServerSocket<org.newsclub.net.unix.AFVSOCKSocketAddress>
      Throws:
      IOException