# Connection error in webrick server

**URL:** <https://www.ruby-forum.com/t/connection-error-in-webrick-server/151864>\
**Category:** Ruby\
**Created:** [October 27, 2008, 7:07am UTC](https://www.ruby-forum.com/t/connection-error-in-webrick-server/151864 "2008-10-27T07:07:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![xedric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/6f9a4e/32.png) [@xedric](https://www.ruby-forum.com/u/xedric)\
**Post date:** [October 27, 2008, 7:07am UTC](https://www.ruby-forum.com/t/connection-error-in-webrick-server/151864/1 "2008-10-27T07:07:04Z")

</div>

I did a simple server in ruby using webrick as shown in the  
tutorial. My problem is that when I tested it with several  
client connection, a number of connections were refused. I  
can’t find the reason why this happens, even though the default  
maximum concurrent client is set to 100. I only made 50 concurrent  
connections but more than 10 connections are often refused. Can  
anyone explain the reason for this.

I also tried changing the default value to a higher value but to no  
avail.

Thanks.

---

<div class="post-metadata">

**Author:** ![xedric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/6f9a4e/32.png) [@xedric](https://www.ruby-forum.com/u/xedric)\
**Post date:** [October 27, 2008, 7:35am UTC](https://www.ruby-forum.com/t/connection-error-in-webrick-server/151864/2 "2008-10-27T07:35:59Z")

</div>

On 27.10.2008 07:06, Cedric Rosario wrote:

> I did a simple server in ruby using webrick as shown in the  
> tutorial. My problem is that when I tested it with several  
> client connection, a number of connections were refused. I  
> can’t find the reason why this happens, even though the default  
> maximum concurrent client is set to 100. I only made 50 concurrent  
> connections but more than 10 connections are often refused. Can  
> anyone explain the reason for this.
> 
> I also tried changing the default value to a higher value but to no  
> avail.

What error message did you see? Are there firewalls in between? Did  
you use hostname for the server URL and can this name be resolved on all  
hosts? …

Kind regards

robert

---

<div class="post-metadata">

**Author:** ![xedric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/6f9a4e/32.png) [@xedric](https://www.ruby-forum.com/u/xedric)\
**Post date:** [October 27, 2008, 8:02am UTC](https://www.ruby-forum.com/t/connection-error-in-webrick-server/151864/3 "2008-10-27T08:02:58Z")

</div>

Robert K. wrote:

> What error message did you see? Are there firewalls in between? Did  
> you use hostname for the server URL and can this name be resolved on all  
> hosts? …
> 
> Kind regards
> 
> robert

This was the error message…  
Errno::ECONNREFUSED: Connection refused - “connect(2)”

There are no firewalls set, and I am only using a single computer for  
this.  
I used the ip address instead of the hostname.

Thanks.

cedric

---

<div class="post-metadata">

**Author:** ![xedric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/6f9a4e/32.png) [@xedric](https://www.ruby-forum.com/u/xedric)\
**Post date:** [October 27, 2008, 11:23pm UTC](https://www.ruby-forum.com/t/connection-error-in-webrick-server/151864/4 "2008-10-27T23:23:26Z")

</div>

Robert K. wrote:

> Hm… Is the hosting system a Windows non server version? That could  
> play a role as well. Or, your Webrick dies for some reason and hence  
> you cannot connect any more. There are so many options where network  
> communication can go wrong…
> 
> Cheers
> 
> robert

I tested it both on a Windows non-server and server versions but the  
results  
were the same. The Webrick does not die because it still accepts  
connections  
whenever I run the my test program. My only problem is that it doesn’t  
accept  
all the connections.

Thanks.

cedric

---

<div class="post-metadata">

**Author:** ![xedric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/6f9a4e/32.png) [@xedric](https://www.ruby-forum.com/u/xedric)\
**Post date:** [October 27, 2008, 9:26am UTC](https://www.ruby-forum.com/t/connection-error-in-webrick-server/151864/5 "2008-10-27T09:26:04Z")

</div>

2008/10/27 cedric so [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> This was the error message…  
> Errno::ECONNREFUSED: Connection refused - “connect(2)”
> 
> There are no firewalls set, and I am only using a single computer for  
> this.  
> I used the ip address instead of the hostname.

Hm… Is the hosting system a Windows non server version? That could  
play a role as well. Or, your Webrick dies for some reason and hence  
you cannot connect any more. There are so many options where network  
communication can go wrong…

Cheers

robert

---

<div class="post-metadata">

**Author:** ![xedric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/6f9a4e/32.png) [@xedric](https://www.ruby-forum.com/u/xedric)\
**Post date:** [October 28, 2008, 7:40am UTC](https://www.ruby-forum.com/t/connection-error-in-webrick-server/151864/6 "2008-10-28T07:40:53Z")

</div>

On 27.10.2008 23:22, cedric so wrote:

> whenever I run the my test program. My only problem is that it doesn’t  
> accept  
> all the connections.

Did you check connection state with netstat? It may be that socket  
resources are not released fast enough. I’m not a network admin but it  
may be that you can remedy this with a changed timeout setting.

Kind regards

robert
