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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.