Top Description Constructors Methods
org.newsclub.net.unix

pack-priv final Class AFGenericServerSocket

extends AFServerSocket<AFGenericSocketAddress>
Class Inheritance
Imports
java.io.FileDescriptor, .IOException, java.net.ServerSocket, .SocketException

The server part of a "unknown-type" socket.
Author
Christian Kohlschütter

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public AFGenericSocket
accept()

Overrides org.newsclub.net.unix.AFServerSocket.accept.

Listens for a connection to be made to this socket and accepts it.

public static AFGenericServerSocket

Returns:

The new, bound AFServerSocket.
bindOn
(final AFGenericSocketAddress
The socket file to bind to.
addr
)

Returns a new unkown-type ServerSocket that is bound to the given AFGenericSocketAddress.

public static AFGenericServerSocket

Returns:

The new, bound AFServerSocket.
bindOn
(final AFGenericSocketAddress
The socket file to bind to.
addr
,
boolean
If true, the socket file (if the address points to a file) will be deleted upon close.
deleteOnClose
)

Returns a new unkown-type ServerSocket that is bound to the given AFSocketAddress.

public static AFGenericServerSocket

Returns:

The new, yet unbound AFServerSocket.
forceBindOn
(final AFGenericSocketAddress
The address to use.
forceAddr
)

Returns a new, unbound unkown-type ServerSocket that will always bind to the given address, regardless of any socket address used in a call to bind.

public AFGenericServerSocketChannel
getChannel()

Overrides org.newsclub.net.unix.AFServerSocket.getChannel.

Returns the unique java.nio.channels.ServerSocketChannel object associated with this socket, if any.

protected AFServerSocketChannel<AFGenericSocketAddress>
newChannel()

Implements abstract org.newsclub.net.unix.AFServerSocket.newChannel.

Creates a new AFServerSocketChannel for this socket.

protected AFSocketImpl<AFGenericSocketAddress>
newImpl(FileDescriptor
The file descriptor.
fdObj
)

Implements abstract org.newsclub.net.unix.AFServerSocket.newImpl.

Creates a new AFSocketImpl.

public static AFGenericServerSocket

Returns:

The new, unbound AFServerSocket.
newInstance
()

Returns a new, unbound unkown-type ServerSocket.

pack-priv static AFGenericServerSocket
newInstance(FileDescriptor fdObj, int localPort, int remotePort)

protected AFSocket<AFGenericSocketAddress>
Inherited from org.newsclub.net.unix.AFServerSocket:
accept1addCloseableaddressFamilybindbindbindHookbindOnbindOncloseforceBindAddressforceBindOngetAFImplgetFileDescriptorgetInetAddressgetLocalPortgetLocalSocketAddressgetOptiongetReceiveBufferSizegetReuseAddressgetSoTimeoutisBoundisClosedisDeleteOnCloseisLocalSocketAddressValidisSupportednewInstancenewInstanceremoveCloseablesetBoundEndpointsetDeleteOnClosesetOptionsetPerformancePreferencessetReceiveBufferSizesetReuseAddresssetShutdownOnClosesetSoTimeoutsupportedOptionstoString

Constructor Detail

AFGenericServerSocketback to summary
pack-priv AFGenericServerSocket(FileDescriptor fdObj) throws IOException

Method Detail

acceptback to summary
public AFGenericSocket accept() throws IOException

Overrides org.newsclub.net.unix.AFServerSocket.accept.

Doc from java.net.ServerSocket.accept.

Listens for a connection to be made to this socket and accepts it. The method blocks until a connection is made.

This method is interruptible in the following circumstances:

  1. The socket is associated with a ServerSocketChannel. In that case, interrupting a thread accepting a connection will close the underlying channel and cause this method to throw java.nio.channels.ClosedByInterruptException with the interrupt status set.
  2. The socket uses the system-default socket implementation and a virtual thread is accepting a connection. In that case, interrupting the virtual thread will cause it to wakeup and close the socket. This method will then throw SocketException with the interrupt status set.
Returns:AFGenericSocket

the new Socket

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs when waiting for a connection, the socket is not bound or the socket is closed.
bindOnback to summary
public static AFGenericServerSocket bindOn(final AFGenericSocketAddress addr) throws IOException

Returns a new unkown-type ServerSocket that is bound to the given AFGenericSocketAddress.

Parameters
addr:AFGenericSocketAddress

The socket file to bind to.

Returns:AFGenericServerSocket

The new, bound AFServerSocket.

Exceptions
IOException:
if the operation fails.
bindOnback to summary
public static AFGenericServerSocket bindOn(final AFGenericSocketAddress addr, boolean deleteOnClose) throws IOException

Returns a new unkown-type ServerSocket that is bound to the given AFSocketAddress.

Parameters
addr:AFGenericSocketAddress

The socket file to bind to.

deleteOnClose:boolean

If true, the socket file (if the address points to a file) will be deleted upon close.

Returns:AFGenericServerSocket

The new, bound AFServerSocket.

Exceptions
IOException:
if the operation fails.
forceBindOnback to summary
public static AFGenericServerSocket forceBindOn(final AFGenericSocketAddress forceAddr) throws IOException

Returns a new, unbound unkown-type ServerSocket that will always bind to the given address, regardless of any socket address used in a call to bind.

Parameters
forceAddr:AFGenericSocketAddress

The address to use.

Returns:AFGenericServerSocket

The new, yet unbound AFServerSocket.

Exceptions
IOException:
if an exception occurs.
getChannelback to summary
public AFGenericServerSocketChannel getChannel()

Overrides org.newsclub.net.unix.AFServerSocket.getChannel.

Doc from java.net.ServerSocket.getChannel.

Returns the unique java.nio.channels.ServerSocketChannel object associated with this socket, if any.

A server socket will have a channel if, and only if, the channel itself was created via the ServerSocketChannel.open method.

Returns:AFGenericServerSocketChannel

the server-socket channel associated with this socket, or null if this socket was not created for a channel

Annotations
@Override
newChannelback to summary
protected AFServerSocketChannel<AFGenericSocketAddress> newChannel()

Implements abstract org.newsclub.net.unix.AFServerSocket.newChannel.

Doc from org.newsclub.net.unix.AFServerSocket.newChannel.

Creates a new AFServerSocketChannel for this socket.

Returns:AFServerSocketChannel<AFGenericSocketAddress>

The new instance.

Annotations
@Override
newImplback to summary
protected AFSocketImpl<AFGenericSocketAddress> newImpl(FileDescriptor fdObj) throws SocketException

Implements abstract org.newsclub.net.unix.AFServerSocket.newImpl.

Doc from org.newsclub.net.unix.AFServerSocket.newImpl.

Creates a new AFSocketImpl.

Parameters
fdObj:FileDescriptor

The file descriptor.

Returns:AFSocketImpl<AFGenericSocketAddress>

The new instance.

Annotations
@Override
newInstanceback to summary
public static AFGenericServerSocket newInstance() throws IOException

Returns a new, unbound unkown-type ServerSocket.

Returns:AFGenericServerSocket

The new, unbound AFServerSocket.

Exceptions
IOException:
if the operation fails.
newInstanceback to summary
pack-priv static AFGenericServerSocket newInstance(FileDescriptor fdObj, int localPort, int remotePort) throws IOException
newSocketInstanceback to summary
protected AFSocket<AFGenericSocketAddress> newSocketInstance() throws IOException

Implements abstract org.newsclub.net.unix.AFServerSocket.newSocketInstance.

Doc from org.newsclub.net.unix.AFServerSocket.newSocketInstance.

Returns a new AFSocket instance.

Returns:AFSocket<AFGenericSocketAddress>

The new instance.

Annotations
@Override
Exceptions
IOException:
on error.