ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Building Highly Scalable Servers with Java NIO
Subject:   Bug
Date:   2006-05-09 04:05:15
From:   Khiraly
Try to connect to it via telnet, and paste some string to it. The java program will always receive 0 byte.


Add a line to PacketChannel.java:151:
System.out.println("0 byte recieved");


It will always print 0 byte received, if you paste strings into the telnet program. Its really strange. I dont known, it is a bug in the progtam or in java or in linux.


I tried jdk 1.4 and 1.5 too (for linux).


Im quite sure, that this is not partial packet received thing, because I can paste into telnet more than 2kB, so its sure, that its more than one packet.


Here is the "modified" code:


if (packet == null) {
// Partial packet received. Must wait for more data. All the contents
// of inBuffer were processed by the protocol decoder. We can
// delete it and prepare for more data.
System.out.println("0 byte");
inBuffer.clear();
reactivateReading();
} else {



Can somebody help me?