Simple client-server using framer

Bruno de Carvalho kindernade at gmail.com
Thu May 19 10:19:32 EDT 2011


Given that your pipeline is empty - no encoders, decoders or handlers - the only supported object you can send to a Channel.write() call is a ChannelBuffer.

Use ChannelBuffers.wrappedBuffer(array) to wrap array (assuming array is [B) in a ChannelBuffer.


Cheers,
  Bruno


On May 19, 2011, at 3:06 PM, Albert Nikola wrote:

> Hi All,
> 
> I'm trying to write simple client and server based on length field framer which passes byte array. However when I try to send the byte array from the client it shows Unexpected exception in selector look warning and throws java.lang.IllegalArgumentException: unsupported message type: class [B. Please give me some tips how do I send raw byte array. Thanks.
> 
> ClientBootstrap bootstrap = new ClientBootstrap(
>                 new NioClientSocketChannelFactory(
>                         Executors.newCachedThreadPool(),
>                         Executors.newCachedThreadPool()));
> 
> bootstrap.setPipelineFactory(new ClientPipelineFactory());
> 
> ChannelFuture future = bootstrap.connect(new InetSocketAddress(host, port));
> Channel ch = future.awaitUninterruptibly().getChannel();
> ch.write(array);
> 
> Albert
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users




More information about the netty-users mailing list