I work on client-server application with flash client and Netty 4.0.24 server. Client communicates with server via XMLSocket. Data is JSON. All work correct. But when i start some stress-test to server, data sometimes lose. JSON Parser throws the exception. My server pipelne is:
ChannelPipeline pipeline=channel.pipeline();
pispeline.addLast("framer", new DelimiterBasedFrameDecoder(8192, Delimiters.nulDelimiter()));
pipeline.addLast(new LoggingHandler(LogLevel.DEBUG));
pipeline.addLast("EchoHandler", new EchoPipe());
at EchoPipe class
public void channelRead(ChannelHandlerContext ctx, Object msg) throws ParseException {
ByteBuf in = (ByteBuf) msg;
String data =in.toString(io.netty.util.CharsetUtil.UTF_8);
DataProcessor.parser.reset();
try{
JSONObject obj = (JSONObject)DataProcessor.parser.parse(data.toString());
...
} catch(ParseException ex){
System.out.println(ex.toString());
System.out.println("err_message: "+data);
}
Sometimes server catch the ParseException. On similar data. This appears when i start about 10 client connections, sending the test packets 3 time a second...
No comments:
Post a Comment