I need to make a client for an existing protocol. I believe Netty would make that relatively straightforward, but could do with a bit of getting started help.
The protocol uses a connection based approach, but layered on top of UDP, with the actual messages inside a transport envelope, with out-of-order / slow / missing packets, session numbering, and the like all the job of the client.
What would be the best way to create the pipelines & frame decoders etc in netty to achieve this. I've only used netty in a very basic way before - so any advice would be very welcome.
Thanks!
James
It sounds pretty painful. I'm a regular netty user, but I would not implement a protocol like this in Netty (not a ding against netty, but it's implemented elsewhere), at least, the way you have described it. Before you go down this road, I would take a look at JGroups which has implemented a "reliable UDP" stack which features all the transport functionality you outlined.
My first stab at this (if I was on a desert island) would be something like:
Downstream
sendMessage
--> MessageSplitHandler
--> MessageFragmentBufferHandler
RetransmitRequester -->
where:
Upstream
This will be more or less the reverse the downstream.
MessageFragmentDecoder <--
MessageFragmentBuffer <--
MessageReAssember <--
onMessage
I think that would be the general idea, but there's probably 200-300 corner cases in there....
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.