User guide for 3.x
Did you know this page is automatically generated from
a Github Wiki page?
You can improve it by yourself
here!
Please read this until the user guide is moved to the wiki.
There is a bug in section 1.6 Writing a Time Client, the TimeClientHandler.java should transfer received signed int to "unsigned int".
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
ChannelBuffer buf = (ChannelBuffer) e.getMessage();
long currentTimeMillis = buf.readInt();
currentTimeMillis = currentTimeMillis >= 0 ? currentTimeMillis :
currentTimeMillis & 0x0FFFFFFFFL;
currentTimeMillis = (currentTimeMillis - 2208988800L) * 1000L;
System.out.println(new Date(currentTimeMillis));
e.getChannel().close();
}
Last retrieved on 13-Nov-2024