Implementing a custom protocol with grizzly

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Implementing a custom protocol with grizzly

John Romanicz


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