You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Tzvika Barenholz <tz...@gmail.com> on 2007/11/28 18:04:20 UTC

help writing a codec-enabled asynchronous client application

Hi all

I'm writing a simulator that needs to make many (say 1,000) connections to a
server, interact with it using a commutative protocol, and examine the
various server responses. I am familiar with how to write such a *Server*
using the MINA api, but I can't seem to find any sample code or directions
for writing a *client*.

The NIO equivalent work that I would do is create 1,000 SocketChannel
objects, connect them all, register them with a selector, and iterate
forever over the selection keys. How can I accomplish this using MINA?

thx in advance
T

Re: help writing a codec-enabled asynchronous client application

Posted by Trustin Lee <tr...@gmail.com>.
Hi Tzvika,

On Nov 29, 2007 2:04 AM, Tzvika Barenholz <tz...@gmail.com> wrote:
> Hi all
>
> I'm writing a simulator that needs to make many (say 1,000) connections to a
> server, interact with it using a commutative protocol, and examine the
> various server responses. I am familiar with how to write such a *Server*
> using the MINA api, but I can't seem to find any sample code or directions
> for writing a *client*.

It's essentially same.  Only one difference is that you have to use an
IoConnector such as SocketConnector.  That's all.  Please let me know
if you are stuck with more specific issues.

> The NIO equivalent work that I would do is create 1,000 SocketChannel
> objects, connect them all, register them with a selector, and iterate
> forever over the selection keys. How can I accomplish this using MINA?

That's what MINA is currently doing.  Please give SocketConnector a try.

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6