Why "java.nio.channels.AsynchronousSocket" always listen tcp port? If it could, how can I use it? Which classes are they?
Asked
Active
Viewed 884 times
3 Answers
0
UDP is done with the DatagramSocket. The nio functionality can be achieved by getting the associated channel.

Brett Okken
- 6,210
- 1
- 19
- 25
-
I might be wrong, but Channels / Selectors are not NIO.2, they belong to the old NIO pattern. – vbence Jul 13 '16 at 11:27
-
@vbence, yes - nio.2 is primarily focused on new ways to work with the file system. The question is really about nio, not nio.2. – Brett Okken Jul 15 '16 at 11:42
0
Because, as the Javadoc says, AsynchronousSocketChannel
is 'an asynchronous channel for stream-oriented connecting sockets', i.e. TCP, and they didn't provide an AsynchronousDatagramChannel
yet.

user207421
- 305,947
- 44
- 307
- 483