Asynchronous socket channels

Asynchronous communication involves making a request, and then proceeding with some other operation without having to wait for the request to be completed. This is referred to as non-blocking.

There are three classes used to support asynchronous channel operations:

  • AsynchronousSocketChannel: This is a simple asynchronous channel to a socket
  • AsynchronousServerSocketChannel: This is an asynchronous channel to a server socket
  • AsynchronousDatagramChannel: This is a channel for a datagram-oriented socket

The read/write methods of the AsynchronousSocketChannel class are asynchronous. The AsynchronousServerSocketChannel class possesses an accept method, which returns an AsynchronousSocketChannel instance. This method is also asynchronous. ...

Get Learning Network Programming with Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.