Ridiculous newbie question

"Trustin Lee (이희승)" trustin at gmail.com
Mon Apr 5 20:27:03 EDT 2010


First off, you did not log the exception but just closed the connection
in exceptionCaught().

Perhaps the exception is about ClassCastException or
IllegalArgumentException which means you are sending unsupported message
type.  You'll have to add proper encoder/decoder to the pipeline in this
case.  Please refer to the Telnet example.

Trustin

Johnny Luong wrote:
> Try removing the "Hello " + ...
> 
> -Johnny
> 
> vibeofboston wrote:
>> This might sound really stupid but I can't seem to figure it out. I have the
>> same exact code as in Chapter 1 of Netty documentation but I can't seem to
>> connet to the server thru telnet. 
>> I looked at the ports running [using netstat] and it said established but
>> then it went to TIME_WAIT. why is the connection lost. 
>> ChannelFactory factory= new
>> NioServerSocketChannelFactory(Executors.newCachedThreadPool(),
>> Executors.newCachedThreadPool());
>> 		
>> 		ServerBootstrap bootstrapper= new ServerBootstrap(factory);
>> 		
>> 		EchoHandler handler= new EchoHandler();
>> 		ChannelPipeline pipeline= bootstrapper.getPipeline();
>> 		
>> 		pipeline.addLast("handler", handler);
>> 		
>> 		bootstrapper.setOption("child.tcpNoDelay", true);
>> 		bootstrapper.setOption("child.keepAlive", true);
>> 		bootstrapper.setOption("child.reuseAddress", true);
>> 		
>> 		bootstrapper.bind(new InetSocketAddress("localhost", 8080));
>> 		System.out.println("Running...");
>>
>>
>>
>>
>> @ChannelPipelineCoverage("all")
>> public class EchoHandler extends SimpleChannelHandler{
>>
>> 	@Override
>> 	public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
>> 			throws Exception {
>> 		Channel channel= e.getChannel();
>> 		channel.write("Hello " + e.getMessage());
>> 	}
>> 	
>> 	@Override
>> 	public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
>> 			throws Exception {
>> 		Channel ch= e.getChannel();
>> 		ch.close();
>> 	}
>> }
>>
> 
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users

-- 
what we call human nature in actuality is human habit
http://gleamynode.net/


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20100406/439cd4aa/attachment-0001.bin 


More information about the netty-users mailing list