Java Non-Blocking I/O Concepts: Difference between revisions
Jump to navigation
Jump to search
Line 20: | Line 20: | ||
{{External|[https://docs.oracle.com/javase/10/docs/api/java/nio/channels/ServerSocketChannel.html ServerSocketChannel]}} | {{External|[https://docs.oracle.com/javase/10/docs/api/java/nio/channels/ServerSocketChannel.html ServerSocketChannel]}} | ||
A [[#Selectable_Channel|selectable channel]] used to listen for incoming network connection and create new SocketChannels. | |||
===SocketChannel=== | |||
{{External|[https://docs.oracle.com/javase/10/docs/api/java/nio/channels/SocketChannel.html SocketChannel]}} | |||
==Buffer== | ==Buffer== |
Revision as of 18:16, 25 July 2018
Internal
Overview
Primitives
Selector
A multiplexor that allows registration of multiple selectable channels so they can be serviced by a single selector thread. The selector thread will block in select() and it will be notified by the selector's implementation only when an I/O event, such as data becoming available or a new connection being established, occurs.
Channel
Selectable channel.
ServerSocketChannel
A selectable channel used to listen for incoming network connection and create new SocketChannels.
SocketChannel
Buffer
Java NIO and TCP Connections
A working example that shows various Java NIO primitives collaborating in establishing a bidirectional TCP connection: