【发布时间】:2012-09-05 06:19:37
【问题描述】:
我正在使用一些在 netty 之上实现的框架。我正在使用以下两个选项从客户端向服务器发送消息。我想这两个 sn-ps 应该将相同的字节写入套接字,它在服务器端的行为是不同的。有什么不同?
选项 1:好的
ChannelBuffer buf = ChannelBuffers.buffer(1);
buf.writeByte(0x1c);
e.getChannel().write(buf);
选项 2:失败
ByteBuffer buf = ByteBuffer.allocate(1);
buf.put(0x1c);
e.getChannel().write(ChannelBuffers.wrappedBuffer(buf));
【问题讨论】:
标签: java asynchronous netty bytebuffer