[xSocket-develop] MaxReadSizeExceededException not thrown
Status: Inactive
Brought to you by:
grro
|
From: Mike C. <xs...@li...> - 2010-08-23 22:30:13
|
I have a class defined as follows:
public class MyHandler implements IDataHandler, IConnectHandler {
in the onConnect method, I call the following on the
INonBlockingConnection (nbc)
nbc.setMaxReadBufferThreshold(10);
In the onData method, I do this:
try {
String line = nbc.readStringByDelimiter("\n");
} catch( MaxReadSizeExceededException e ){
nbc.close();
}
I assumed that the read operation would throw a
MaxReadSizeExceededException if I sent more than 10 bytes down the
channel without a linefeed? What actually happens is that the onData
method stops being called when I hit 10 characters. There is no
exception thrown during the read. Have I misunderstood the purpose of
MaxReadSizeExceededException or have I stumbled across a bug?
I am trying to code for a protocol where the de-limiter is "\n" and
there is a fixed maximum line length. I basically want a to prevent a
malicious application from sending a large quantity of data down the
channel without any linefeeds purely to use up memory...
P.S. Thank you for answering my previous question regarding the LGPL Gregor.
--
Mike Cardwell - Perl/Java/Web developer, Linux admin, Email admin
Read my tech Blog - https://secure.grepular.com/
Follow me on Twitter - http://twitter.com/mickeyc
Hire me - http://cardwellit.com/ http://uk.linkedin.com/in/mikecardwell
|