DatagramChannel数据报通道
DatagramChannel数据报通道
打开一个DatagramChannel(Opening a DatagramChannel)
DatagramChannel channel = DatagramChannel.open();
channel.socket().bind(new InetSocketAddress(9999));接收数据(Receiving Data)
ByteBuffer buf = ByteBuffer.allocate(48);
buf.clear();
**channel.receive(buf);**发送数据(Sending Data)
链接特定机器地址(Connecting to a Specific Address)
Last updated