Simple client-server using framer

Albert Nikola albert.nikola at gmail.com
Thu May 19 11:00:21 EDT 2011


Thank you very much Bruno. Now it works like a charm :).

On Thu, May 19, 2011 at 10:19 AM, Bruno de Carvalho <kindernade at gmail.com>wrote:

> 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
>
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20110519/763eef99/attachment.html 


More information about the netty-users mailing list