Code example to write asynchronous server

yanky young yanky.young at gmail.com
Fri Apr 10 14:16:15 EDT 2009


Hi:

I am not netty expert yet. I am just trying to give some hints. In your
case, you are actually building a request/response protocol. And request and
response message may include quite complicated headers and body. So you have
to do some message encoding and decoding in both server side and client
side. You can see in netty codebase there are some out-of-box encoder and
decoder in handler.codec package. I suggest you take a look at
example.fractorial package to see how to implement your own encoder and
decoder for your message format which may be xml. If you are not sensitive
to message format, you can also have a look at example.localtime which use
google protobuf library as real encoder and decoder.

good luck

yanky



2009/4/11 manishr22 <manishr22 at gmail.com>

>
> Hi Yanky,
>
> I took the sample code from svn trunk and saw the codes too. Could you
> please let me know which one among given sample code will fit for the
> reference of my requirement.
>
> Regards,
> Manish
>
> Hi:
>
> Of course there are some sample code in netty project. You can just check
> out the svn trunk and see some samples in example package.
>
> good luck
>
> yanky
>
>
> 2009/4/10 manishr22 <manishr22 at gmail.com>
>
> >
> > Hi,
> >
> > I had a problem statement
> >
> > "to write an asynchronous TCP server to which multiple clients will
> connect
> > and keep sending messages to my tcp server. My server should read the
> > message and send back some acknowledgment information to the client who
> sent
> > the data. While reading the data at server since the message comes in
> > particular format i have to do some processing before sending the
> response
> > back to client."
> >
> > say my client is sending a message structure in which it has some header
> > and then in body it has message like :
> >
> > <manish>welcome to the real world</manish>
> >
> > I was on the way to implement NIO but in between i found such a great
> > library netty and thought of using it. i was trying to make use of this
> > library with the given tutorial and examples but i found that tutorial is
> > not good enough to solve the complex problem.
> >
> > If you can provide me some guidance or sample code that how i should
> solve
> > my problem using netty library, that would be great.
> >
> > Thanks in advance.
> >
> > Regards
> > Manish
> > --
> > View this message in context:
> >
> http://n2.nabble.com/Code-example-to-write-asynchronous-server-tp2615889p2615889.html
> > Sent from the Netty User Group mailing list archive at Nabble.com.
> >
> > _______________________________________________
> > 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
>
>
>
> --
> View this message in context:
> http://n2.nabble.com/Code-example-to-write-asynchronous-server-tp2615889p2617267.html
> Sent from the Netty User Group mailing list archive at Nabble.com.
>
> _______________________________________________
> 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/20090411/55d5f224/attachment.html 


More information about the netty-users mailing list