Hey Emmanuel,

Thanks for the tip. I'll try that.

I'll just have to make sure that I don't lose any buffered data somewhere,
but since that's in an IoBuffer I think I'll be good.
Losing bits while decoding random analog sound signals is not a good idea
;-)

Thanks!!

On Mon, Oct 27, 2008 at 1:22 PM, Emmanuel Lecharny <[EMAIL PROTECTED]>wrote:

> Rodrigo Madera wrote:
>
>> Hello there,
>>
>> I wish to know if there is some kind of protocol selector class based on
>> session state.
>> As strange as I make it sound, it's a simple concept once I can state it
>> right, so let me try to make it clear by using an example:
>>
>> Imagine a protocol where one 3CPO robot talks to another 3CPO robot (that
>> golden robot from Star Wars that talks a lot).
>> Since he can talk in N different dialects (or languages, mind SW fans
>> here),
>> imagine that it's protocol can be different based on the current dialect
>> they are using.
>>
>> To make things even more strange (and complicated), let's say that they
>> use
>> yet a different protocol even to handshake.
>> Once they settle on a given dialect, that dialect corresponds to it's own
>> protocol, having it's own messages and thus it's own family of encoders
>> and
>> decoders.
>>
>> So wrapping up, we have a protocol which:
>>
>> 1) Is actually a collection of different protocols.
>> 2) Can switch to any other underlying protocol at any time.
>>
>> In theory, what I'm looking for is something that I would implement, given
>> my knowledge at the time, like this:
>>
>> SuperProtocol
>>    encode(...):
>>        switch session.currentProtocol {
>>        HANDSHAKING: HANDSHAKING.encode/decode(...)
>>        KLINGON: KLINGON.encode/decode(...)
>>        DAFFYLISH: DAFFYLISH.encode/decode(...)
>>
>>
>> I hope that I got the message right, since this is kind of hard for me to
>> explain. I guess this is not so common on the protocol landscape since a
>> message format is adhered to. But there are sometimes where there is
>> really
>> the need to completely switch the protocol being used.
>>
>>
> You already can switch the protocol live during a session. Just get the
> current session chain, remove the previous protocolCodec, and inject the new
> protocolCodec.
>
> That should do the trick (except that it won't understand D2R2 language,
> because the protocol is unkown ... :)
>
>
> --
> --
> cordialement, regards,
> Emmanuel Lécharny
> www.iktek.com
> directory.apache.org
>
>
>

Reply via email to