FrameDecoder for UDP stream

Jan Van Besien janvanbesien at gmail.com
Fri May 7 02:21:12 EDT 2010


Yes indeed. What I implemented is very much like what you describe. I 
was just wondering if maybe there is something in Netty on which I can 
build the functionality described, rather than building it from scratch 
using a SimpleChannelUpstreamHandler.


Kind regards
Jan

On 05/06/2010 10:14 PM, Ankush Bhatiya wrote:
> Hi,
>
> In FrameDecoder, create a HashMap<Conversation, List<Conversation>>,
> also TreeMap<TimeStamp, Conversation>. Create a thread in constructor
> which timely check this treemap and remove all the timeout conversation
> from both maps. Also when new conversation comes add this to hashmap and
> if End of conversation is reached(I hope you have some delimiter for
> this) push this conversation to your business logic. Isn't this work?
>
> Ankush
>
> On Thu, May 6, 2010 at 5:11 PM, Jan Van Besien <janvanbesien at gmail.com
> <mailto:janvanbesien at gmail.com>> wrote:
>
>     Hi
>
>     I am looking for ideas on how to implement something in netty.
>
>     I am writing a netty client (and test/mock server) for a binary UDP
>     protocol. The payload is protobuf and the transport layer is UDP. Each
>     protobuf message is splitted over different UDP packets. Each UDP packet
>     contains a header and a body. The body is a part of the protobuf
>     message, the header contains a conversation number (identifies a single
>     request-response conversation), a packet number and a total number of
>     packets (total meaning the total to get the whole protobuf payload) and
>     a length field describing how long the body is.
>
>     Downstream it looks like this (I think this is OK):
>     - my business logic handler creates protobuf messages
>     - a protobuf encoder encodes the message in binary format
>     - a custom OneToOneEncoder creates a ChunkedInput which creates the UDP
>     packets as described above
>     - a chunkedWriteHandler writes the chunks
>
>     I currently designed the upstream pipeline like this:
>
>     - (1) a lengthfieldbasedframedecoder to cope with potentially fragmented
>     UDP packets
>     - (2) something which assembles multiple "chunked" UDP packets into a
>     single protobuf message
>     - (3) a protobuf decoder
>     - (4) my business logic
>
>     The problem is (2). I think something based on a FrameDecoder is not
>     sufficient, because potentially multiple "conversations" are going on at
>     the same time. So I should have something which buffers all input per
>     ongoing conversation, and sends a message upstream when all packets for
>     a certain conversation have arrived. When that happens, it should clear
>     the buffer for this conversation, but not the others. Potentially I also
>     want to clear incomplete buffers after a certain timeout.
>
>     Is there something in netty on which I can build for this kind of
>     functionality?
>
>     Am I maybe complicating things too much? I am involved in the design of
>     the protocol as well, so things can still be changed.
>
>     Kind regards
>     Jan
>     _______________________________________________
>     netty-users mailing list
>     netty-users at lists.jboss.org <mailto: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



More information about the netty-users mailing list