users@grizzly.java.net

Re: manage ad-hoc protocol over TCP connections

From: Oleksiy Stashok <oleksiy.stashok_at_oracle.com>
Date: Mon, 23 Apr 2012 14:59:58 +0200

Hi,

On 04/23/2012 02:28 PM, marcelloraffaele_at_gmail.com wrote:
> I was trying to use a Filter to do it but i have the following
> problems:
> - messages are splittet in pieces and it call "handleRead" more times.
That's expected, you can either receive a Buffer, that contains single
protocol message, part of a protocol message, or more than one protocol
message... you can easily handle this in your Filter
The GIOPFilter sample (see its handleRead implementation) should help
you understand how to deal w/ it:
http://java.net/projects/grizzly/sources/git/content/samples/framework-samples/src/main/java/org/glassfish/grizzly/samples/filterchain/GIOPFilter.java

There is FilterChain documentation
http://grizzly.java.net/nonav/docs/docbkx2.0/html/filterchain-filters.html

The InvokeAction and StopAction description might help.

> - i need to manage timeouts while the packet is coming. If the packet
> isn't completely received i need to send a "nack". How i can do it over
> a Filter?
>
> Is Filter the best way to do it or i can use other Grizzly Object to
> make it?
Filter is the proper place to implement that logic.

> Maybe i need to extend some class and implement something.
Filter :)

Thanks.

WBR,
Alexey.