O'Reilly logo

Learning Network Programming with Java by Richard M Reese

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Channel support for UDP

The DatagramChannel class provides additional support for UDP. It can support nonblocking interchanges. The DatagramChannel class is derived from the SelectableChannel class that makes multithreaded application easier. We will examine its use in Chapter 7, Network Scalability.

The DatagramSocket class binds a channel to a port. After this class is used, it is no longer used directly. Using the DatagramChannel class means, we do not have to use datagram packets directly. Instead, data is transferred using an instance of the ByteBuffer class. This class provides several convenient methods to access its data.

To demonstrate the use of the DatagramChannel class, we will develop an echo server and client application. The server ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required