O'Reilly logo

Java I/O, NIO and NIO.2 by Jeff Friesen

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

Chapter    14

Completion of Socket Channel Functionality

Completion of socket channel functionality is JDK 7’s final contribution to NIO.2. The java.nio.channels package’s DatagramChannel, ServerSocketChannel, and SocketChannel classes have been extended to support binding and option configuration. Also, channel-based multicasting is supported. This chapter wraps up the book by introducing you to these capabilities.

Binding and Option Configuration

NIO’s DatagramChannel, ServerSocketChannel, and SocketChannel classes don’t completely abstract a network socket. To bind into the channel’s socket, or to get/set socket options, you have to first retrieve the peer socket by invoking each class’s socket() method.

This counterintuitive mix of socket ...

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