Structured message reading problem in Netty.

manishr22 manishr22 at gmail.com
Fri Apr 24 01:16:23 EDT 2009


Hi Trustin,

Sorry to bug you guys much. 

I did read the explanation about FrameDecoder and did the earlier
implementation using the same. In my earlier post i gave those source code
too. Since that was also having problem in buffer's capacity() and
resetReaderIndex().

I am sorry to give an impression like i wanted to get my code fixed by
someone else, but i never had this intention, i only wanted to get the
advice and opinion from Netty expert, since i was learning this.

Regards
Manish 

Trustin Lee-2 wrote:
> 
> Hi Manish,
> 
> Looking from your code, you don't have a FrameDecoder or
> ReplayingDecoder in a pipeline, which means you have a good chance to
> receive only partial data, which leads to IndexOutOfBoundsException.
> Did you have a chance to read the first chapter of the user guide?
> There's good amount of explanation about this issue there.
> 
> You and other community members have exchanged quite a lot of
> questions and answers so far.  My impression so far is that you just
> want people to fix your code.  We could solve your problem just by
> writing the fixed code for you, but it would be much better for you to
> follow all the step demonstrated in the user guide.  Then you will
> know what is wrong with your current code very easily.
> 
> Also, you might find the factorial example more useful than the
> discard example for your case.
> 
> — Trustin Lee, http://gleamynode.net/
> 
> On Thu, Apr 23, 2009 at 8:45 PM, manishr22 <manishr22 at gmail.com> wrote:
>>
>> Hi,
>>
>> I am new to netty and tried writing netty-server as per my requirement
>> seeing various examples. But i am not getting the result correctly.
>>
>>
>> I am trying to write a netty server that can read the that will read the
>> message-structre from normal synchronous multi-threaded client ( say 10
>> client is sending 1000 messages each ) to the server.
>>
>>
>> By message structure i mean my client is sending the message in the
>> format :
>>
>>
>> [MESSAGE 1-CLIENT 1]    message-length(first 4 byte) header length(next 4
>> byte) data (including
>>
>> header and body as specified bytes of message length and header length)
>>
>>
>> [MESSAGE 2-CLIENT 1]    message-length(first 4 byte) header length(next 4
>> byte) data (including
>>
>> header and body as specified bytes of message length and header length)
>>
>>
>> ........
>>
>> ........
>>
>> [MESSAGE 1-CLIENT 2]    message-length(first 4 byte) header length(next 4
>> byte) data (including
>>
>> header and body as specified bytes of message length and header length)
>>
>>
>> [MESSAGE 2-CLIENT 2]    message-length(first 4 byte) header length(next 4
>> byte) data (including
>>
>> header and body as specified bytes of message length and header length)
>>
>> ....
>> .....
>>
>> [For N number of client and N
>> http://n2.nabble.com/file/n2682454/netty.zip
>> netty.zip  number of messages]
>>
>> and now my netty server should read all the different messages from
>> client/s
>> and do the proper message parsing and do some business operation.
>>
>>
>> How i can implement the reading of message-structure using netty.
>>
>>
>> I saw several example and implemented something in it. but its not giving
>> the appropriate result rather i am getting exception all the time.
>>
>> The basic source code which i tried for this is also attached for
>> reference.
>>
>> Any suggestion and help with some sample code will be really appreciated.
>>
>>
>> Regards
>>
>> Manish
>>
>>
>>
>> --
>> View this message in context:
>> http://n2.nabble.com/Structured-message-reading-problem-in-Netty.-tp2682454p2682454.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/Structured-message-reading-problem-in-Netty.-tp2682454p2689756.html
Sent from the Netty User Group mailing list archive at Nabble.com.





More information about the netty-users mailing list