Re: http server and "Connection Refused"

Giganews Newsgroups
Subject: Re: http server and "Connection Refused"
Posted by:  Remy Lebeau (TeamB) (no.spam@no.spam.com)
Date: Thu, 9 Dec 2004

"Dave Brown" <dave.bro…@blueflag.co.uk> wrote in message
news:0D54C6FF0BB7E240dave.bro…@blueflag.co.uk...

> When running the Http Server (the Indy demo HTTP Server),
> I use a client app that creates 50 + clients to my server.
>
> Some of the requests fail with "Connection refused", but not others.

You are probably making the requests too quickly.  When a client is making a
new connection to a server, the connection is placed into a queue until the
server has a chance to call accept() to remove a connection from the queue
and make it active.  A server socket can only queue up so many incoming
connections at a time.  The rest of the incoming connections are refused
until queue space is available again.

TIdTCPServer, the ancestor for TIdHTTPServer, has a ListenQueue property
that defaults to 15.  That means that the queue can only contain a maximum
of 15 queued connections at a time.  If the queue is full, further
connections are refused.

Try increasing the ListenQueue.  If you set it to MaxInt, the socket stack
decides what maximum queu size is appropriate for itself.

Gambit

Replies

None

In response to

http server and "Connection Refused" posted by Dave Brown on Tue, 7 Dec 2004