Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[ace-users] Re: Question on ACE_SOCK_Connector

3 views
Skip to first unread message

Douglas C. Schmidt

unread,
Nov 24, 1999, 3:00:00 AM11/24/99
to
Hi,

> I have a Client/Server application based on ACE. And
>They use ACE_SOCK_Connector and ACE_SOCK_Acceptor to
>communicate with.

Ok.

> In order to test my codes, I leave the server runing
>all the time and have my client exit-run-exit for hundrends
>times. Then, some times later(not a fixed number, random),
>SOCK_Connector::connect() will return -1. I check the
>current value of errno, it is 146(ECONNREFUSED). However,
>my server is still there with that port. Why does it refuse
>the connection request from my client. Why does it accept
>that before?

I suspect that the "listen queue" on the server is full because you're
sending many connections rapidly. You should read the second volume
of Richard Steven's book called "TCP/IP Illustrated" to learn why this
is happening.

> And if I delete SOCK_Connector object, sleep sometime,
>re-create a new SOCK_Connector object and then call
>SOCK_Connector::connect() again, it will success!

Right, that's giving the server's listen queue some time to drain.

Take care,

Doug
--
Dr. Douglas C. Schmidt, Associate Professor
Department of Computer Science, Washington University
St. Louis, MO 63130. Work #: (314) 935-4215; FAX #: (314) 935-7302
sch...@cs.wustl.edu, www.cs.wustl.edu/~schmidt/

James Hu

unread,
Nov 25, 1999, 3:00:00 AM11/25/99
to
On 24 Nov 1999 07:53:54 -0600, Douglas C. Schmidt
<sch...@cs.wustl.edu> wrote:

>> In order to test my codes, I leave the server runing
>>all the time and have my client exit-run-exit for hundrends
>>times. Then, some times later(not a fixed number, random),
>>SOCK_Connector::connect() will return -1. I check the
>>current value of errno, it is 146(ECONNREFUSED). However,
>>my server is still there with that port. Why does it refuse
>>the connection request from my client. Why does it accept
>>that before?
>
>I suspect that the "listen queue" on the server is full because you're
>sending many connections rapidly. You should read the second volume
>of Richard Steven's book called "TCP/IP Illustrated" to learn why this
>is happening.

Doug's advice is on target. In addition, depending on just how
quickly you are generating successive connections, the time wait
interval might be getting in the way as well. After a TCP connection
is closed, the OS will not actually surrender the resource associated
with that connection for some amount of time (on Solaris, this
interval is 4 minutes by default). This is because there is the
possibility that if the resource is reused too soon, you might read in
data associated with the previous connection if the connection to the
other end-point was slow.

Networks are much faster and more reliable than they used to be, so it
is probably safe to reduce this interval to around 1 minute, but your
mileage may vary.

--
James C. Hu <j...@cs.wustl.edu> Computer Science Doctoral Candidate
http://www.cs.wustl.edu/~jxh/ Washington University in Saint Louis
>>>>>>>>>>>>> I use *SpamBeGone* <URL:http://www.internz.com/SpamBeGone/>

0 new messages