# Rb\_sys\_fail(socket(2)) - errno == 0

**URL:** <https://www.ruby-forum.com/t/rb-sys-fail-socket-2-errno-0/145079>\
**Category:** Ruby\
**Created:** [August 5, 2008, 8:18pm UTC](https://www.ruby-forum.com/t/rb-sys-fail-socket-2-errno-0/145079 "2008-08-05T20:18:08Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Glen\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/34f0e0/32.png) [@Glen\_H](https://www.ruby-forum.com/u/Glen_H)\
**Post date:** [August 5, 2008, 8:18pm UTC](https://www.ruby-forum.com/t/rb-sys-fail-socket-2-errno-0/145079/1 "2008-08-05T20:18:08Z")

</div>

That is the error message I get when I try either of these methods for  
creating an ICMP packet:

socket = Socket.new(Socket::PF\_INET, Socket::SOCK\_RAW,  
Socket::IPPROTO\_ICMP)

or

with net-ping

icmp = Ping::ICMP.new(‘machine\_name’)

icmp.ping?

I am on Windows XP. The account I’m logged in as has local  
administrator  
rights.

What I’m trying to do is check to see if a system is up before I try and  
make a WIN32OLE connection to it as they take forever to time-out

–  
“Hey brother Christian with your high and mighty errand, Your actions  
speak  
so loud, I can’t hear a word you’re saying.”

-Greg Graffin (Bad Religion)

---

<div class="post-metadata">

**Author:** ![Glen\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/34f0e0/32.png) [@Glen\_H](https://www.ruby-forum.com/u/Glen_H)\
**Post date:** [August 5, 2008, 8:35pm UTC](https://www.ruby-forum.com/t/rb-sys-fail-socket-2-errno-0/145079/2 "2008-08-05T20:35:59Z")

</div>

You can use Ping from the Ruby standard library.

require ‘ping’  
Ping.pingecho “[google.com](http://google.com)”, ,

Where timeout is the number of seconds to wait for a reply (defaults to  
5) and port is the port to use (defaults to the ‘echo’ port)

Unless you have something more specific you are trying to do this ought  
to work.

Glen H. wrote:

> That is the error message I get when I try either of these methods for  
> creating an ICMP packet:
> 
> socket = Socket.new(Socket::PF\_INET, Socket::SOCK\_RAW,  
> Socket::IPPROTO\_ICMP)
> 
> or
> 
> with net-ping
> 
> icmp = Ping::ICMP.new(‘machine\_name’)
> 
> icmp.ping?
> 
> I am on Windows XP. The account I’m logged in as has local  
> administrator  
> rights.
> 
> What I’m trying to do is check to see if a system is up before I try and  
> make a WIN32OLE connection to it as they take forever to time-out
> 
> –  
> “Hey brother Christian with your high and mighty errand, Your actions  
> speak  
> so loud, I can’t hear a word you’re saying.”
> 
> -Greg Graffin (Bad Religion)

---

<div class="post-metadata">

**Author:** ![Glen\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/34f0e0/32.png) [@Glen\_H](https://www.ruby-forum.com/u/Glen_H)\
**Post date:** [August 5, 2008, 8:43pm UTC](https://www.ruby-forum.com/t/rb-sys-fail-socket-2-errno-0/145079/3 "2008-08-05T20:43:57Z")

</div>

On Tue, Aug 5, 2008 at 12:34 PM, Phill D.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)wrote:

> to work.
> 
> > with net-ping  
> > What I’m trying to do is check to see if a system is up before I try and  
> > Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

I was actually hoping for something that creates a real ICMP packet as I  
can’t be certain what ports are open on given workstations on the  
network.

–  
“Hey brother Christian with your high and mighty errand, Your actions  
speak  
so loud, I can’t hear a word you’re saying.”

-Greg Graffin (Bad Religion)

---

<div class="post-metadata">

**Author:** ![Glen\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/34f0e0/32.png) [@Glen\_H](https://www.ruby-forum.com/u/Glen_H)\
**Post date:** [August 6, 2008, 1:45am UTC](https://www.ruby-forum.com/t/rb-sys-fail-socket-2-errno-0/145079/4 "2008-08-06T01:45:48Z")

</div>

Glen H. wrote:

> > > or
> > > 
> > > What I’m trying to do is check to see if a system is up before I try and  
> > > make a WIN32OLE connection to it as they take forever to time-out

It’s a problem with the socket.so file that ships with the one click  
installer. Take a look at this ticket for more information:

[http://rubyforge.org/tracker/?func=detail&group\_id=167&aid=9438&atid=715](http://rubyforge.org/tracker/?func=detail&group_id=167&aid=9438&atid=715)

Regards,

Dan

---

<div class="post-metadata">

**Author:** ![Glen\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/34f0e0/32.png) [@Glen\_H](https://www.ruby-forum.com/u/Glen_H)\
**Post date:** [August 8, 2008, 3:36pm UTC](https://www.ruby-forum.com/t/rb-sys-fail-socket-2-errno-0/145079/5 "2008-08-08T15:36:36Z")

</div>

On Aug 5, 12:15 pm, “Glen H.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> icmp.ping?
> 
> I am on Windows XP. The account I’m logged in as has local administrator  
> rights.
> 
> What I’m trying to do is check to see if a system is up before I try and  
> make a WIN32OLE connection to it as they take forever to time-out

It’s a busted socket.so in the one click installer I’m afraid (who, in  
turn, get it from the core team).

See  
[http://rubyforge.org/tracker/?func=detail&group\_id=167&aid=9438&atid=715](http://rubyforge.org/tracker/?func=detail&group_id=167&aid=9438&atid=715)  
for more information.

Works fine when I use a version of Ruby built with VC++ 8.

Regards,

Dan

---

<div class="post-metadata">

**Author:** ![Glen\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/34f0e0/32.png) [@Glen\_H](https://www.ruby-forum.com/u/Glen_H)\
**Post date:** [August 8, 2008, 3:50pm UTC](https://www.ruby-forum.com/t/rb-sys-fail-socket-2-errno-0/145079/6 "2008-08-08T15:50:39Z")

</div>

On Aug 6, 4:17 am, “Heesob P.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > > > icmp = Ping::ICMP.new(‘machine\_name’)  
> > > > > It’s a problem with the socket.so file that ships with the one click  
> > > > > If you build ruby without ‘–with-winsock2’, it will work fine.  
> > > > > My bad. Thanks for the clarification.

Dan

---

<div class="post-metadata">

**Author:** ![Glen\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/34f0e0/32.png) [@Glen\_H](https://www.ruby-forum.com/u/Glen_H)\
**Post date:** [August 6, 2008, 12:20pm UTC](https://www.ruby-forum.com/t/rb-sys-fail-socket-2-errno-0/145079/7 "2008-08-06T12:20:07Z")

</div>

2008/8/6 Daniel B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> > > Where timeout is the number of seconds to wait for a reply (defaults to
> > > 
> > > >
> 
> [http://rubyforge.org/tracker/?func=detail&group\_id=167&aid=9438&atid=715](http://rubyforge.org/tracker/?func=detail&group_id=167&aid=9438&atid=715)

The socket.so has nothing to do with this problem.  
It’s a problem with the msvcrt-ruby18.dll file.

That bug is related to the winsock2 compatibility.

The OCI version was built with the flag ‘–with-winsock2’.  
If you build ruby without ‘–with-winsock2’, it will work fine.

Regards,

Park H.

Park H.

---

<div class="post-metadata">

**Author:** ![Glen\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/34f0e0/32.png) [@Glen\_H](https://www.ruby-forum.com/u/Glen_H)\
**Post date:** [August 8, 2008, 4:57pm UTC](https://www.ruby-forum.com/t/rb-sys-fail-socket-2-errno-0/145079/8 "2008-08-08T16:57:28Z")

</div>

On Aug 8, 7:33 am, Daniel B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Regards,
> 
> Dan

Ignore this dupe. Submitting replies via the Google groups interface  
is seriously messed up. Lately about a third of my posts never arrive,  
another third show up several days later (as this one did), with the  
final third actually posting in a timely manner.

Dan

---

<div class="post-metadata">

**Author:** ![Glen\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/34f0e0/32.png) [@Glen\_H](https://www.ruby-forum.com/u/Glen_H)\
**Post date:** [August 8, 2008, 3:56pm UTC](https://www.ruby-forum.com/t/rb-sys-fail-socket-2-errno-0/145079/9 "2008-08-08T15:56:33Z")

</div>

On Fri, Aug 8, 2008 at 7:43 AM, Daniel B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > > > [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)wrote:
> > > > 
> > > > > Unless you have something more specific you are trying to do this
> > > > > 
> > > > > > Socket::IPPROTO\_ICMP)  
> > > > > > administrator  
> > > > > > [http://rubyforge.org/tracker/?func=detail&group\_id=167&aid=9438&atid=715](http://rubyforge.org/tracker/?func=detail&group_id=167&aid=9438&atid=715)
> 
> Dan

Thanks guys.

–  
“Hey brother Christian with your high and mighty errand, Your actions  
speak  
so loud, I can’t hear a word you’re saying.”

-Greg Graffin (Bad Religion)
