ServerSocketChannel.Accept Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Accepts a connection made to this channel's socket.
[Android.Runtime.Register("accept", "()Ljava/nio/channels/SocketChannel;", "GetAcceptHandler")]
public abstract Java.Nio.Channels.SocketChannel? Accept ();
[<Android.Runtime.Register("accept", "()Ljava/nio/channels/SocketChannel;", "GetAcceptHandler")>]
abstract member Accept : unit -> Java.Nio.Channels.SocketChannel
Returns
The socket channel for the new connection,
or null
if this channel is in non-blocking mode
and no connection is available to be accepted
- Attributes
Exceptions
if this channel is closed by another thread while this method is in operation.
if another thread interrupts the calling thread while this operation is in progress. The interrupt state of the calling thread is set and the channel is closed.
if this channel is closed.
if another I/O error occurs.
if the socket has not yet been bound.
Remarks
Accepts a connection made to this channel's socket.
If this channel is in non-blocking mode then this method will immediately return null
if there are no pending connections. Otherwise it will block indefinitely until a new connection is available or an I/O error occurs.
The socket channel returned by this method, if any, will be in blocking mode regardless of the blocking mode of this channel.
This method performs exactly the same security checks as the java.net.ServerSocket#accept accept
method of the java.net.ServerSocket
class. That is, if a security manager has been installed then for each new connection this method verifies that the address and port number of the connection's remote endpoint are permitted by the security manager's java.lang.SecurityManager#checkAccept checkAccept
method.
Java documentation for java.nio.channels.ServerSocketChannel.accept()
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.