- All Implemented Interfaces:
Closeable
,AutoCloseable
,AFSomeSocketThing
,FileDescriptorAccess
The server part of an AF_UNIX domain socket.
- Author:
- Christian Kohlschütter
-
Nested Class Summary
Nested classes/interfaces inherited from class org.newsclub.net.unix.AFServerSocket
AFServerSocket.Constructor<A extends AFSocketAddress>
-
Constructor Summary
ModifierConstructorDescriptionprotected
Constructs a new, unconnected instance. -
Method Summary
Modifier and TypeMethodDescriptionaccept()
static AFUNIXServerSocket
Returns a new AF_UNIXServerSocket
that is bound to the given path.static AFUNIXServerSocket
Returns a new AF_UNIXServerSocket
that is bound to the given path.static AFUNIXServerSocket
bindOn
(AFUNIXSocketAddress addr) Returns a new AF_UNIXServerSocket
that is bound to the givenAFUNIXSocketAddress
.static AFUNIXServerSocket
bindOn
(AFUNIXSocketAddress addr, boolean deleteOnClose) Returns a new AF_UNIXServerSocket
that is bound to the givenAFSocketAddress
.static AFUNIXServerSocket
forceBindOn
(AFUNIXSocketAddress forceAddr) Returns a new, unbound AF_UNIXServerSocket
that will always bind to the given address, regardless of any socket address used in a call tobind
.protected AFUNIXServerSocketChannel
Creates a new AFServerSocketChannel for this socket.protected AFSocketImpl
<AFUNIXSocketAddress> newImpl
(FileDescriptor fdObj) Creates a new AFSocketImpl.static AFUNIXServerSocket
Returns a new, unbound AF_UNIXServerSocket
.protected AFUNIXSocket
Returns a newAFSocket
instance.Methods inherited from class org.newsclub.net.unix.AFServerSocket
addCloseable, addressFamily, bind, bind, bindHook, bindOn, bindOn, close, forceBindAddress, forceBindOn, getFileDescriptor, getInetAddress, getLocalPort, getLocalSocketAddress, getOption, getReceiveBufferSize, getReuseAddress, getSoTimeout, isBound, isClosed, isDeleteOnClose, isLocalSocketAddressValid, isSupported, newInstance, newInstance, removeCloseable, setDeleteOnClose, setOption, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setShutdownOnClose, setSoTimeout, supportedOptions, toString
Methods inherited from class java.net.ServerSocket
implAccept, setSocketFactory
-
Constructor Details
-
AFUNIXServerSocket
Constructs a new, unconnected instance.- Throws:
IOException
- if the operation fails.
-
-
Method Details
-
newChannel
Description copied from class:AFServerSocket
Creates a new AFServerSocketChannel for this socket.- Specified by:
newChannel
in classAFServerSocket<AFUNIXSocketAddress>
- Returns:
- The new instance.
-
getChannel
- Overrides:
getChannel
in classAFServerSocket<AFUNIXSocketAddress>
-
newInstance
Returns a new, unbound AF_UNIXServerSocket
.- Returns:
- The new, unbound
AFServerSocket
. - Throws:
IOException
- if the operation fails.
-
bindOn
Returns a new AF_UNIXServerSocket
that is bound to the givenAFUNIXSocketAddress
.- Parameters:
addr
- The socket file to bind to.- Returns:
- The new, bound
AFServerSocket
. - Throws:
IOException
- if the operation fails.
-
bindOn
public static AFUNIXServerSocket bindOn(AFUNIXSocketAddress addr, boolean deleteOnClose) throws IOException Returns a new AF_UNIXServerSocket
that is bound to the givenAFSocketAddress
.- Parameters:
addr
- The socket file to bind to.deleteOnClose
- Iftrue
, the socket file (if the address points to a file) will be deleted uponAFServerSocket.close()
.- Returns:
- The new, bound
AFServerSocket
. - Throws:
IOException
- if the operation fails.
-
bindOn
Returns a new AF_UNIXServerSocket
that is bound to the given path.- Parameters:
path
- The path to bind to.deleteOnClose
- Iftrue
, the socket file will be deleted uponAFServerSocket.close()
.- Returns:
- The new, bound
AFServerSocket
. - Throws:
IOException
- if the operation fails.
-
bindOn
Returns a new AF_UNIXServerSocket
that is bound to the given path.- Parameters:
path
- The path to bind to.deleteOnClose
- Iftrue
, the socket file will be deleted uponAFServerSocket.close()
.- Returns:
- The new, bound
AFServerSocket
. - Throws:
IOException
- if the operation fails.
-
forceBindOn
Returns a new, unbound AF_UNIXServerSocket
that will always bind to the given address, regardless of any socket address used in a call tobind
.- Parameters:
forceAddr
- The address to use.- Returns:
- The new, yet unbound
AFServerSocket
. - Throws:
IOException
- if an exception occurs.
-
newImpl
Description copied from class:AFServerSocket
Creates a new AFSocketImpl.- Specified by:
newImpl
in classAFServerSocket<AFUNIXSocketAddress>
- Parameters:
fdObj
- The file descriptor.- Returns:
- The new instance.
- Throws:
SocketException
-
newSocketInstance
Returns a newAFSocket
instance.- Specified by:
newSocketInstance
in classAFServerSocket<AFUNIXSocketAddress>
- Returns:
- The new instance.
- Throws:
IOException
- on error.
-
accept
- Overrides:
accept
in classAFServerSocket<AFUNIXSocketAddress>
- Throws:
IOException
-