You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Simon Aquilina <si...@hotmail.com> on 2007/08/14 17:11:52 UTC
Server supporting multiple protocols at the same time
Hi,
I just managed to get the mina examples running in my free time :) I have
also viewed the presentation available under the user documentations! From
the documentation I can understand that mina allows you to have different
protocols! However can I have different protocols at the same time? That is
can I build a server that can accept both http and socket connections and
feed their results with the same IOHandler? I am sorry if the question
sounds newb! From what I read I feel that the answer is Yes However wanted
to confirm that!
Thanks and Regards,
Sim085
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
Re: Server supporting multiple protocols at the same time
Posted by Niklas Therning <ni...@trillian.se>.
If you are writing a server application and want to use a single
IoHandler implementation with different protocols you could give
different IoServiceConfig objects for each call to IoAcceptor.bind().
Before you call bind() you configure the filter chain of each
IoServiceConfig with an appropriate ProtocolCodecFilter.
Pseudo code for chat server supporting MSN and AIM protocols:
ProtocolCodecFilter aimCodecFilter = ...;
ProtocolCodecFilter msnCodecFilter = ...;
SocketAcceptorConfig aimConfig = new SocketAcceptorConfig();
aimConfig.getFilterChain().addFirst("aimCodec", aimCodecFilter);
SocketAcceptorConfig msnConfig = new SocketAcceptorConfig();
msnConfig.getFilterChain().addFirst("msnCodec", msnCodecFilter);
SocketAcceptor acceptor = ...;
acceptor.bind(new InetSocketAddress(...), myChatHandler, aimCodecFilter);
acceptor.bind(new InetSocketAddress(...), myChatHandler, msnCodecFilter);
Please note that I have no idea how the MSN and AIM protocols actually
work. The above is only to illustrate. :-)
In SpamDrain we use the same IoHandler to service both SSL encrypted and
non SSL POP3 and IMAP connections. It works similarly to the above.
BTW, IIRC you only need MINA 2.0 if you want to have several
ProtocolCodecFilters in the same filter chain.
HTH
/Niklas
mat wrote:
> Only in MINA 2.0, you will be able to add more than one ProtocolCodecFilter.
> Am I right?
>
> On 8/14/07, Kevin Williams <ke...@gmail.com> wrote:
>
>> Yes, you can. We have one IoHandler which delegates to different
>> codecs to process the request.
>>
>> On 8/14/07, Simon Aquilina <si...@hotmail.com> wrote:
>>
>>> Hi,
>>>
>>> I just managed to get the mina examples running in my free time :) I
>>>
>> have
>>
>>> also viewed the presentation available under the user documentations!
>>>
>> From
>>
>>> the documentation I can understand that mina allows you to have
>>>
>> different
>>
>>> protocols! However can I have different protocols at the same time? That
>>>
>> is
>>
>>> can I build a server that can accept both http and socket connections
>>>
>> and
>>
>>> feed their results with the same IOHandler? I am sorry if the question
>>> sounds newb! From what I read I feel that the answer is 'Yes' However
>>>
>> wanted
>>
>>> to confirm that!
>>>
>>> Thanks and Regards,
>>> Sim085
>>>
>>> _________________________________________________________________
>>> Express yourself instantly with MSN Messenger! Download today it's FREE!
>>> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>>>
>>>
>>>
>> --
>> Cheers,
>>
>> Kevin Williams
>> http://www.almostserio.us/
>> http://kevwil.tumblr.com/
>> http://kevwil.jaiku.com/
>>
>>
>
>
--
Niklas Therning
www.spamdrain.net
Re: Server supporting multiple protocols at the same time
Posted by mat <fo...@gmail.com>.
Only in MINA 2.0, you will be able to add more than one ProtocolCodecFilter.
Am I right?
On 8/14/07, Kevin Williams <ke...@gmail.com> wrote:
>
> Yes, you can. We have one IoHandler which delegates to different
> codecs to process the request.
>
> On 8/14/07, Simon Aquilina <si...@hotmail.com> wrote:
> > Hi,
> >
> > I just managed to get the mina examples running in my free time :) I
> have
> > also viewed the presentation available under the user documentations!
> From
> > the documentation I can understand that mina allows you to have
> different
> > protocols! However can I have different protocols at the same time? That
> is
> > can I build a server that can accept both http and socket connections
> and
> > feed their results with the same IOHandler? I am sorry if the question
> > sounds newb! From what I read I feel that the answer is 'Yes' However
> wanted
> > to confirm that!
> >
> > Thanks and Regards,
> > Sim085
> >
> > _________________________________________________________________
> > Express yourself instantly with MSN Messenger! Download today it's FREE!
> > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> >
> >
>
>
> --
> Cheers,
>
> Kevin Williams
> http://www.almostserio.us/
> http://kevwil.tumblr.com/
> http://kevwil.jaiku.com/
>
Re: Server supporting multiple protocols at the same time
Posted by Kevin Williams <ke...@gmail.com>.
Yes, you can. We have one IoHandler which delegates to different
codecs to process the request.
On 8/14/07, Simon Aquilina <si...@hotmail.com> wrote:
> Hi,
>
> I just managed to get the mina examples running in my free time :) I have
> also viewed the presentation available under the user documentations! From
> the documentation I can understand that mina allows you to have different
> protocols! However can I have different protocols at the same time? That is
> can I build a server that can accept both http and socket connections and
> feed their results with the same IOHandler? I am sorry if the question
> sounds newb! From what I read I feel that the answer is 'Yes' However wanted
> to confirm that!
>
> Thanks and Regards,
> Sim085
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's FREE!
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
>
--
Cheers,
Kevin Williams
http://www.almostserio.us/
http://kevwil.tumblr.com/
http://kevwil.jaiku.com/