You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by leafsax <le...@hotmail.com> on 2007/10/19 09:25:53 UTC

Combine a SocketConnector and a SocketAcceptor

Hi,

I implemented a PeerServer and a PeerClient using SocketAcceptor and a
SocketConnector,
and they performed good on both side, the scalability, throughput and
stability were good. 
Then I wanted to do something else --- put PeerServer and PeerClient
together in an application,
since it is named Peer. There were 2 threads in SocketAcceptor and
SocketConnector ---
both of which contains a Worker and a SocketIoProccessor, they are doing
similar things, so I 
want to combine them together, then I can use 1 selector thread(acceptor or
connector worker) 
and 1 IO proccessor thread to do both things.

Summary:
Combine SocketAcceptor and SocketConnector to use 1 worker and 1
SocketIoProccessor

How can I do this? 
Any hint is welcome, thank you.
-- 
View this message in context: http://www.nabble.com/Combine-a-SocketConnector-and-a-SocketAcceptor-tf4651519s16868.html#a13289565
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: Combine a SocketConnector and a SocketAcceptor

Posted by leafsax <le...@hotmail.com>.
Yes, it is just what I want.
Is there better way?


elihusmails wrote:
> 
> are you trying to write some form of a proxy?
> 
> 
> On 10/19/07, mat <fo...@gmail.com> wrote:
>> Why you need to do something like this?
>>
>> On 10/19/07, leafsax <le...@hotmail.com> wrote:
>>
>> >
>> > Hi,
>> >
>> > I implemented a PeerServer and a PeerClient using SocketAcceptor and a
>> > SocketConnector,
>> > and they performed good on both side, the scalability, throughput and
>> > stability were good.
>> > Then I wanted to do something else --- put PeerServer and PeerClient
>> > together in an application,
>> > since it is named Peer. There were 2 threads in SocketAcceptor and
>> > SocketConnector ---
>> > both of which contains a Worker and a SocketIoProccessor, they are
>> doing
>> > similar things, so I
>> > want to combine them together, then I can use 1 selector
>> thread(acceptor
>> > or
>> > connector worker)
>> > and 1 IO proccessor thread to do both things.
>> >
>> > Summary:
>> > Combine SocketAcceptor and SocketConnector to use 1 worker and 1
>> > SocketIoProccessor
>> >
>> > How can I do this?
>> > Any hint is welcome, thank you.
>> > --
>> > View this message in context:
>> >
>> http://www.nabble.com/Combine-a-SocketConnector-and-a-SocketAcceptor-tf4651519s16868.html#a13289565
>> > Sent from the Apache MINA Support Forum mailing list archive at
>> Nabble.com
>> > .
>> >
>> >
>>
> 
> 
> -- 
> --------------------------------
> The adjuration to be "normal" seems shockingly repellent to me; I see
> neither hope nor comfort in sinking to that low level. I think it is
> ignorance that makes people think of abnormality only with horror and
> allows them to remain undismayed at the proximity of "normal" to
> average and mediocre. For surely anyone who achieves anything is,
> essentially, abnormal.
>      Dr. Karl Menninger
> 
> 

-- 
View this message in context: http://www.nabble.com/Combine-a-SocketConnector-and-a-SocketAcceptor-tf4651519s16868.html#a13335391
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: Combine a SocketConnector and a SocketAcceptor

Posted by Mark <el...@gmail.com>.
are you trying to write some form of a proxy?


On 10/19/07, mat <fo...@gmail.com> wrote:
> Why you need to do something like this?
>
> On 10/19/07, leafsax <le...@hotmail.com> wrote:
>
> >
> > Hi,
> >
> > I implemented a PeerServer and a PeerClient using SocketAcceptor and a
> > SocketConnector,
> > and they performed good on both side, the scalability, throughput and
> > stability were good.
> > Then I wanted to do something else --- put PeerServer and PeerClient
> > together in an application,
> > since it is named Peer. There were 2 threads in SocketAcceptor and
> > SocketConnector ---
> > both of which contains a Worker and a SocketIoProccessor, they are doing
> > similar things, so I
> > want to combine them together, then I can use 1 selector thread(acceptor
> > or
> > connector worker)
> > and 1 IO proccessor thread to do both things.
> >
> > Summary:
> > Combine SocketAcceptor and SocketConnector to use 1 worker and 1
> > SocketIoProccessor
> >
> > How can I do this?
> > Any hint is welcome, thank you.
> > --
> > View this message in context:
> > http://www.nabble.com/Combine-a-SocketConnector-and-a-SocketAcceptor-tf4651519s16868.html#a13289565
> > Sent from the Apache MINA Support Forum mailing list archive at Nabble.com
> > .
> >
> >
>


-- 
--------------------------------
The adjuration to be "normal" seems shockingly repellent to me; I see
neither hope nor comfort in sinking to that low level. I think it is
ignorance that makes people think of abnormality only with horror and
allows them to remain undismayed at the proximity of "normal" to
average and mediocre. For surely anyone who achieves anything is,
essentially, abnormal.
     Dr. Karl Menninger

Re: Combine a SocketConnector and a SocketAcceptor

Posted by mat <fo...@gmail.com>.
Why you need to do something like this?

On 10/19/07, leafsax <le...@hotmail.com> wrote:

>
> Hi,
>
> I implemented a PeerServer and a PeerClient using SocketAcceptor and a
> SocketConnector,
> and they performed good on both side, the scalability, throughput and
> stability were good.
> Then I wanted to do something else --- put PeerServer and PeerClient
> together in an application,
> since it is named Peer. There were 2 threads in SocketAcceptor and
> SocketConnector ---
> both of which contains a Worker and a SocketIoProccessor, they are doing
> similar things, so I
> want to combine them together, then I can use 1 selector thread(acceptor
> or
> connector worker)
> and 1 IO proccessor thread to do both things.
>
> Summary:
> Combine SocketAcceptor and SocketConnector to use 1 worker and 1
> SocketIoProccessor
>
> How can I do this?
> Any hint is welcome, thank you.
> --
> View this message in context:
> http://www.nabble.com/Combine-a-SocketConnector-and-a-SocketAcceptor-tf4651519s16868.html#a13289565
> Sent from the Apache MINA Support Forum mailing list archive at Nabble.com
> .
>
>

Re: Combine a SocketConnector and a SocketAcceptor

Posted by leafsax <le...@hotmail.com>.
Thank you very much. I will keep them, and hope your work on
SocketIoProccessor goes well.



Trustin Lee wrote:
> 
> On 10/19/07, leafsax <le...@hotmail.com> wrote:
>>
>> Hi,
>>
>> I implemented a PeerServer and a PeerClient using SocketAcceptor and a
>> SocketConnector,
>> and they performed good on both side, the scalability, throughput and
>> stability were good.
>> Then I wanted to do something else --- put PeerServer and PeerClient
>> together in an application,
>> since it is named Peer. There were 2 threads in SocketAcceptor and
>> SocketConnector ---
>> both of which contains a Worker and a SocketIoProccessor, they are doing
>> similar things, so I
>> want to combine them together, then I can use 1 selector thread(acceptor
>> or
>> connector worker)
>> and 1 IO proccessor thread to do both things.
>>
>> Summary:
>> Combine SocketAcceptor and SocketConnector to use 1 worker and 1
>> SocketIoProccessor
>>
>> How can I do this?
> 
> We are currently working on combining SocketIoProcessor threads.
> However, I don't see much benefit combining SocketAcceptor and
> Connector workers.  Of course, it will make sense though to make one
> SocketAcceptor thread to handle multiple binds and
> SocketConnectorConnector thread to handler multiple connection
> attempts.
> 
> HTH,
> Trustin
> -- 
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
> 
> 

-- 
View this message in context: http://www.nabble.com/Combine-a-SocketConnector-and-a-SocketAcceptor-tf4651519s16868.html#a13357377
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: Combine a SocketConnector and a SocketAcceptor

Posted by Trustin Lee <tr...@gmail.com>.
On 10/19/07, leafsax <le...@hotmail.com> wrote:
>
> Hi,
>
> I implemented a PeerServer and a PeerClient using SocketAcceptor and a
> SocketConnector,
> and they performed good on both side, the scalability, throughput and
> stability were good.
> Then I wanted to do something else --- put PeerServer and PeerClient
> together in an application,
> since it is named Peer. There were 2 threads in SocketAcceptor and
> SocketConnector ---
> both of which contains a Worker and a SocketIoProccessor, they are doing
> similar things, so I
> want to combine them together, then I can use 1 selector thread(acceptor or
> connector worker)
> and 1 IO proccessor thread to do both things.
>
> Summary:
> Combine SocketAcceptor and SocketConnector to use 1 worker and 1
> SocketIoProccessor
>
> How can I do this?

We are currently working on combining SocketIoProcessor threads.
However, I don't see much benefit combining SocketAcceptor and
Connector workers.  Of course, it will make sense though to make one
SocketAcceptor thread to handle multiple binds and
SocketConnectorConnector thread to handler multiple connection
attempts.

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