OioDatagramChannelFactory for client and server?
hezjing
hezjing at gmail.com
Mon Apr 20 07:09:22 EDT 2009
Hi Trustin
Yes, I have read the QOTM example and I have tried that with Netty 3.1
BETA1.
I was thinking that ServerBootstrap generic, and it is applicable for
all ChannelFactory.
In this case, I think the ServerBootstrap is applicable with all
ChannelFactory except the DatagramChannelFactory?
I think that is something worth to explain in the Javadoc
of ServerBootstrap(ChannelFactory).
Thank you!
On Mon, Apr 20, 2009 at 6:31 PM, Trustin Lee <tlee at redhat.com> wrote:
> You do not need to use ServerBootstrap for the UDP transport. Could
> you please read the QOTM example?
>
> — Trustin Lee, http://gleamynode.net/
>
> On Mon, Apr 20, 2009 at 6:31 PM, hezjing <hezjing at gmail.com> wrote:
> > Hi
> > I'm trying to create a UDP server with Netty 3.1 BETA2, here is the code
> > snippet:
> > ChannelFactory factory = new
> > OioDatagramChannelFactory(Executors.newCachedThreadPool());
> > ServerBootstrap bootstrap = new ServerBootstrap(factory);
> > ChannelPipeline pipeline = bootstrap.getPipeline();
> > pipeline.addLast("logger", new LoggingHandler(true));
> > ...
> > Channel channel = bootstrap.bind(new
> InetSocketAddress(listenPort));
> >
> > When run, it throws the following exception:
> > Exception in thread "main" java.lang.IllegalArgumentException: factory
> must
> > be a ServerChannelFactory:
> > class org.jboss.netty.channel.socket.oio.OioDatagramChannelFactory
> > at
> >
> org.jboss.netty.bootstrap.ServerBootstrap.setFactory(ServerBootstrap.java:183)
> > at org.jboss.netty.bootstrap.Bootstrap.<init>(Bootstrap.java:73)
> > at
> >
> org.jboss.netty.bootstrap.ServerBootstrap.<init>(ServerBootstrap.java:174)
> >
> > Do you have any idea of what could be the reason?
> >
> > On Wed, Apr 8, 2009 at 4:50 PM, Trustin Lee <tlee at redhat.com> wrote:
> >>
> >> On Wed, Apr 8, 2009 at 5:49 PM, Trustin Lee <tlee at redhat.com> wrote:
> >> > On Sat, Apr 4, 2009 at 5:06 PM, hezjing <hezjing at gmail.com> wrote:
> >> >> Hi
> >> >> The Javadoc explains that OioDatagramChannelFactory is to create
> >> >> a blocking
> >> >> I/O based UDP client.
> >> >>
> >> >> What should we use to create a UDP server?
> >> >
> >> > Actually, you can create a UDP client using OioDatagramChannelFactory.
> >> > It was a documentation mistake. Please refer to the QOTM server
> >> > example.
> >>
> >> Oops. Actually, you can create both UDP client and server using
> >> OioDatagramChannelFactory. It was a documentation mistake. Please
> >> refer to the QOTM server example.
> >>
> >> _______________________________________________
> >> netty-users mailing list
> >> netty-users at lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/netty-users
> >
> >
> >
> > --
> >
> > Hez
> >
> > _______________________________________________
> > 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
>
--
Hez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20090420/ac7672d0/attachment.html
More information about the netty-users
mailing list