关于NIO和socket的一些问题

Some questions about NIO and socket

您好,我目前正在尝试学习 NIO 范式,并且有一些问题以便更好地理解这种编码方式。 在非阻塞模式下:

感谢您的帮助

Why should I use a selector for the writing process?

你不应该,除非你有一个零长度的写入。

why not directly use the write method if i have a hmi.

没错,这就是你通常应该做的。

how could I read a single line from a byteBuffer?

一次一个字节。它没有线条的概念。