# AsynchronousServerSocketChannel

public abstract class **AsynchronousServerSocketChannel** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
implements [AsynchronousChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousChannel.html) [NetworkChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/NetworkChannel.html) An asynchronous channel for stream-oriented listening sockets.

An asynchronous server-socket channel is created by invoking the
`https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html#open()` method of this class.
A newly-created asynchronous server-socket channel is open but not yet bound.
It can be bound to a local address and configured to listen for connections
by invoking the `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html#bind(java.net.SocketAddress,%20int)` method. Once bound,
the `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html#accept(A,%20java.nio.channels.CompletionHandler<java.nio.channels.AsynchronousSocketChannel,%20?%20super%20A>)` method
is used to initiate the accepting of connections to the channel's socket.
An attempt to invoke the accept method on an unbound channel will
cause a `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/NotYetBoundException.html` to be thrown.

Channels of this type are safe for use by multiple concurrent threads
though at most one accept operation can be outstanding at any time.
If a thread initiates an accept operation before a previous accept operation
has completed then an `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AcceptPendingException.html` will be thrown.

Socket options are configured using the `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html#setOption(java.net.SocketOption<T>,%20T)` method. Channels of this type support the following options:
>
> | Option Name | Description |
> |---|---|
> | `https://developers.google.com/j2objc/javadoc/jre/reference/java/net/StandardSocketOptions.html#SO_RCVBUF` | The size of the socket receive buffer |
> | `https://developers.google.com/j2objc/javadoc/jre/reference/java/net/StandardSocketOptions.html#SO_REUSEADDR` | Re-use address |

Additional (implementation specific) options may also be supported.

**Usage Example:**

```
  final AsynchronousServerSocketChannel listener =
      AsynchronousServerSocketChannel.open().bind(new InetSocketAddress(5000));

  listener.accept(null, new CompletionHandler<AsynchronousSocketChannel,Void>() {
      public void completed(AsynchronousSocketChannel ch, Void att) {
          // accept the next connection
          listener.accept(null, this);

          // handle this connection
          handle(ch);
      }
      public void failed(Throwable exc, Void att) {
          ...
      }
  });
 
```

<br />

### Protected Constructor Summary

|---|---|
|   | [AsynchronousServerSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html#AsynchronousServerSocketChannel(java.nio.channels.spi.AsynchronousChannelProvider))([AsynchronousChannelProvider](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/spi/AsynchronousChannelProvider.html) provider) Initializes a new instance of this class. |

### Public Method Summary

|---|---|
| abstract \<A\> void | [accept](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html#accept(A,%20java.nio.channels.CompletionHandler<java.nio.channels.AsynchronousSocketChannel,%20?%20super%20A>))(A attachment, [CompletionHandler](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/CompletionHandler.html)\<[AsynchronousSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousSocketChannel.html), ? super A\> handler) Accepts a connection. |
| abstract [Future](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Future.html)\<[AsynchronousSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousSocketChannel.html)\> | [accept](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html#accept())() Accepts a connection. |
| abstract [AsynchronousServerSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html) | [bind](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html#bind(java.net.SocketAddress,%20int))([SocketAddress](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/SocketAddress.html) local, int backlog) Binds the channel's socket to a local address and configures the socket to listen for connections. |
| final [AsynchronousServerSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html) | [bind](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html#bind(java.net.SocketAddress))([SocketAddress](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/SocketAddress.html) local) Binds the channel's socket to a local address and configures the socket to listen for connections. |
| abstract [SocketAddress](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/SocketAddress.html) | [getLocalAddress](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html#getLocalAddress())() Returns the socket address that this channel's socket is bound to. If there is a security manager set, its `checkConnect` method is called with the local address and `-1` as its arguments to see if the operation is allowed. |
| static [AsynchronousServerSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html) | [open](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html#open(java.nio.channels.AsynchronousChannelGroup))([AsynchronousChannelGroup](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousChannelGroup.html) group) Opens an asynchronous server-socket channel. |
| static [AsynchronousServerSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html) | [open](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html#open())() Opens an asynchronous server-socket channel. |
| final [AsynchronousChannelProvider](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/spi/AsynchronousChannelProvider.html) | [provider](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html#provider())() Returns the provider that created this channel. |
| abstract \<T\> [AsynchronousServerSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html) | [setOption](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html#setOption(java.net.SocketOption<T>,%20T))([SocketOption](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/SocketOption.html)\<T\> name, T value) Sets the value of a socket option. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

From interface [java.nio.channels.AsynchronousChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousChannel.html)

|---|---|
| abstract void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousChannel.html#close())() Closes this channel. |

From interface [java.nio.channels.NetworkChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/NetworkChannel.html)

|---|---|
| abstract [NetworkChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/NetworkChannel.html) | [bind](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/NetworkChannel.html#bind(java.net.SocketAddress))([SocketAddress](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/SocketAddress.html) local) Binds the channel's socket to a local address. |
| abstract [SocketAddress](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/SocketAddress.html) | [getLocalAddress](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/NetworkChannel.html#getLocalAddress())() Returns the socket address that this channel's socket is bound to. |
| abstract \<T\> T | [getOption](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/NetworkChannel.html#getOption(java.net.SocketOption<T>))([SocketOption](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/SocketOption.html)\<T\> name) Returns the value of a socket option. |
| abstract \<T\> [NetworkChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/NetworkChannel.html) | [setOption](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/NetworkChannel.html#setOption(java.net.SocketOption<T>,%20T))([SocketOption](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/SocketOption.html)\<T\> name, T value) Sets the value of a socket option. |
| abstract [Set](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html)\<[SocketOption](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/SocketOption.html)\<?\>\> | [supportedOptions](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/NetworkChannel.html#supportedOptions())() Returns a set of the socket options supported by this channel. |

From interface [java.nio.channels.Channel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Channel.html)

|---|---|
| abstract void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Channel.html#close())() Closes this channel. |
| abstract boolean | [isOpen](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Channel.html#isOpen())() Tells whether or not this channel is open. |

From interface [java.io.Closeable](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Closeable.html)

|---|---|
| abstract void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Closeable.html#close())() Closes this stream and releases any system resources associated with it. |

From interface [java.lang.AutoCloseable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/AutoCloseable.html)

|---|---|
| abstract void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/AutoCloseable.html#close())() Closes this resource, relinquishing any underlying resources. |

## Protected Constructors

#### protected
**AsynchronousServerSocketChannel**
([AsynchronousChannelProvider](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/spi/AsynchronousChannelProvider.html) provider)

Initializes a new instance of this class.

##### Parameters

| provider | The provider that created this channel |
|---|---|

## Public Methods

#### public abstract void
**accept**
(A attachment, [CompletionHandler](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/CompletionHandler.html)\<[AsynchronousSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousSocketChannel.html), ? super A\> handler)

Accepts a connection.

This method initiates an asynchronous operation to accept a
connection made to this channel's socket. The `handler` parameter is
a completion handler that is invoked when a connection is accepted (or
the operation fails). The result passed to the completion handler is
the `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousSocketChannel.html` to the new connection.

When a new connection is accepted then the resulting `AsynchronousSocketChannel` will be bound to the same `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousChannelGroup.html` as this channel. If the group is `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousChannelGroup.html#isShutdown()` and a connection is accepted,
then the connection is closed, and the operation completes with an `IOException` and cause `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/ShutdownChannelGroupException.html`.

To allow for concurrent handling of new connections, the completion
handler is not invoked directly by the initiating thread when a new
connection is accepted immediately (see [Threading](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousChannelGroup#threading)).

If a security manager has been installed then it verifies that the
address and port number of the connection's remote endpoint are permitted
by the security manager's `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/SecurityManager.html#checkAccept(java.lang.String,%20int)`
method. The permission check is performed with privileges that are restricted
by the calling context of this method. If the permission check fails then
the connection is closed and the operation completes with a `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/SecurityException.html`.

##### Parameters

| attachment | The object to attach to the I/O operation; can be `null` |
| handler | The handler for consuming the result |
|---|---|

##### Throws

| [AcceptPendingException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AcceptPendingException.html) | If an accept operation is already in progress on this channel |
| [NotYetBoundException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/NotYetBoundException.html) | If this channel's socket has not yet been bound |
| [ShutdownChannelGroupException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/ShutdownChannelGroupException.html) | If the channel group has terminated |
|---|---|

#### public abstract [Future](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Future.html)\<[AsynchronousSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousSocketChannel.html)\>
**accept**
()

Accepts a connection.

This method initiates an asynchronous operation to accept a
connection made to this channel's socket. The method behaves in exactly
the same manner as the `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html#accept(A,%20java.nio.channels.CompletionHandler<java.nio.channels.AsynchronousSocketChannel,%20?%20super%20A>)` method
except that instead of specifying a completion handler, this method
returns a `Future` representing the pending result. The `Future`'s `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/Future.html#get()` method returns the `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousSocketChannel.html` to the new connection on successful completion.

##### Returns

- a `Future` object representing the pending result

##### Throws

| [AcceptPendingException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AcceptPendingException.html) | If an accept operation is already in progress on this channel |
| [NotYetBoundException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/NotYetBoundException.html) | If this channel's socket has not yet been bound |
|---|---|

#### public abstract [AsynchronousServerSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html)
**bind**
([SocketAddress](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/SocketAddress.html) local, int backlog)

Binds the channel's socket to a local address and configures the socket to
listen for connections.

This method is used to establish an association between the socket and
a local address. Once an association is established then the socket remains
bound until the associated channel is closed.

The `backlog` parameter is the maximum number of pending
connections on the socket. Its exact semantics are implementation specific.
In particular, an implementation may impose a maximum length or may choose
to ignore the parameter altogther. If the `backlog` parameter has
the value `0`, or a negative value, then an implementation specific
default is used.

##### Parameters

| local | The local address to bind the socket, or `null` to bind to an automatically assigned socket address |
| backlog | The maximum number of pending connections |
|---|---|

##### Returns

- This channel

##### Throws

| [AlreadyBoundException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AlreadyBoundException.html) | If the socket is already bound |
| [UnsupportedAddressTypeException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/UnsupportedAddressTypeException.html) | If the type of the given address is not supported |
| [SecurityException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/SecurityException.html) | If a security manager has been installed and its `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/SecurityManager.html#checkListen(int)` method denies the operation |
| [ClosedChannelException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/ClosedChannelException.html) | If the channel is closed |
| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | If some other I/O error occurs |
|---|---|

#### public final [AsynchronousServerSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html)
**bind**
([SocketAddress](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/SocketAddress.html) local)

Binds the channel's socket to a local address and configures the socket to
listen for connections.

An invocation of this method is equivalent to the following:
>
> ```
>  bind(local, 0);
>  
> ```

<br />

##### Parameters

| local | The local address to bind the socket, or null to bind to an automatically assigned socket address |
|---|---|

##### Returns

- This channel

##### Throws

| [AlreadyBoundException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AlreadyBoundException.html) |   |
| [UnsupportedAddressTypeException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/UnsupportedAddressTypeException.html) |   |
| [SecurityException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/SecurityException.html) |   |
| [ClosedChannelException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/ClosedChannelException.html) |   |
| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) |   |
|---|---|

#### public abstract [SocketAddress](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/SocketAddress.html)
**getLocalAddress**
()

Returns the socket address that this channel's socket is bound to.

Where the channel is `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/NetworkChannel.html#bind(java.net.SocketAddress)` to an Internet Protocol
socket address then the return value from this method is of type `https://developers.google.com/j2objc/javadoc/jre/reference/java/net/InetSocketAddress.html`.


If there is a security manager set, its `checkConnect` method is
called with the local address and `-1` as its arguments to see
if the operation is allowed. If the operation is not allowed,
a `SocketAddress` representing the
`https://developers.google.com/j2objc/javadoc/jre/reference/java/net/InetAddress.html#getLoopbackAddress()` address and the
local port of the channel's socket is returned.

##### Returns

- The `SocketAddress` that the socket is bound to, or the `SocketAddress` representing the loopback address if denied by the security manager, or `null` if the channel's socket is not bound

##### Throws

| [ClosedChannelException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/ClosedChannelException.html) |   |
| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) |   |
|---|---|

#### public static [AsynchronousServerSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html)
**open**
([AsynchronousChannelGroup](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousChannelGroup.html) group)

Opens an asynchronous server-socket channel.

The new channel is created by invoking the `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/spi/AsynchronousChannelProvider.html#openAsynchronousServerSocketChannel(java.nio.channels.AsynchronousChannelGroup)` method on the `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/spi/AsynchronousChannelProvider.html` object that created
the given group. If the group parameter is null then the
resulting channel is created by the system-wide default provider, and
bound to the *default group*.

##### Parameters

| group | The group to which the newly constructed channel should be bound, or null for the default group |
|---|---|

##### Returns

- A new asynchronous server socket channel

##### Throws

| [ShutdownChannelGroupException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/ShutdownChannelGroupException.html) | If the channel group is shutdown |
| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | If an I/O error occurs |
|---|---|

#### public static [AsynchronousServerSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html)
**open**
()

Opens an asynchronous server-socket channel.

This method returns an asynchronous server socket channel that is
bound to the *default group*. This method is equivalent to evaluating
the expression:
>
> ```
>  open((AsynchronousChannelGroup)null);
>  
> ```

<br />

##### Returns

- A new asynchronous server socket channel

##### Throws

| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | If an I/O error occurs |
|---|---|

#### public final [AsynchronousChannelProvider](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/spi/AsynchronousChannelProvider.html)
**provider**
()

Returns the provider that created this channel.

##### Returns

- The provider that created this channel

#### public abstract [AsynchronousServerSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html)
**setOption**
([SocketOption](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/SocketOption.html)\<T\> name, T value)

Sets the value of a socket option.

##### Parameters

| name | The socket option |
| value | The value of the socket option. A value of `null` may be a valid value for some socket options. |
|---|---|

##### Returns

- This channel

##### Throws

| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) |   |
| [ClosedChannelException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/ClosedChannelException.html) |   |
| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) |   |
|---|---|