users@grizzly.java.net

Implementing a custom protocol with grizzly

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Date: Mon, 07 Jan 2008 14:59:04 +0100

Hello,

due to some problems, several emails where not delivered to the list.
So, I'm resending them.

From: John Romanicz <romanicz_at_conclude.de>

Hello Dear Grizzly Team,
maybe you could give me some hints to get me started:
Lets say I have a custom Protocol which clients send over TCP/IP to
Grizzly server :

<magic number> [integer]
<msg length> [integer]
<bytes> [Serialized object]

I guess I need to write a com.sun.grizzly.ProtocolFilter which parses
the protocol (probably a State machine)
and add it to the Grizzly Protocolchain.
I suppose the ByteBuffer which Grizzly passes to the ProtocolFilter has
a "fixed byte limit".
So when a Client sends a message bigger than the "fixed byte limit" I
need to make sure the same ProtocolFilter gets recalled.
How do I make sure that big messages use the same ProtocolFilter instance?
On the other hand of course how do I make sure that different calling
clients have their own ProtocolFilter instances?

Many Greetings
John