1:NIO通道客户端的实现步骤
1,SocketChannel打开通道
2,connect连接指定的IP和端口号
3,写入数据
4,关闭通道释放资源
public static void main(String[] args) throws IOException {
SocketChannel open=SocketChannel.open();
open.connect(new InetSocketAddress("192.168.1.46",9999));
//写入数据
ByteBuffer byteBuffer=ByteBuffer.wrap("yyds".getBytes());
open.write(byteBuffer);
open