# Crash when using sockets

**URL:** <https://www.ruby-forum.com/t/crash-when-using-sockets/110391>\
**Category:** Ruby\
**Created:** [July 25, 2007, 11:51pm UTC](https://www.ruby-forum.com/t/crash-when-using-sockets/110391 "2007-07-25T23:51:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![memetical](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e495f1/32.png) [@memetical](https://www.ruby-forum.com/u/memetical)\
**Post date:** [July 25, 2007, 11:51pm UTC](https://www.ruby-forum.com/t/crash-when-using-sockets/110391/1 "2007-07-25T23:51:23Z")

</div>

whenever I try to use the following socket, an error window pops up  
saying rubyw.exe has requested the runtime to teminate it in an unusual  
way. I am running XP SP2 and ruby-1.8.6.

the socket i try to open is the following:  
@s = Socket.open(Socket::PF\_INET, Socket::SOCK\_RAW, Socket::IPPROTO\_RAW)

anyone have an explination?

---

<div class="post-metadata">

**Author:** ![memetical](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e495f1/32.png) [@memetical](https://www.ruby-forum.com/u/memetical)\
**Post date:** [July 26, 2007, 10:43pm UTC](https://www.ruby-forum.com/t/crash-when-using-sockets/110391/2 "2007-07-26T22:43:30Z")

</div>

First L. wrote:

> whenever I try to use the following socket, an error window pops up  
> saying rubyw.exe has requested the runtime to teminate it in an unusual  
> way. I am running XP SP2 and ruby-1.8.6.
> 
> the socket i try to open is the following:  
> @s = Socket.open(Socket::PF\_INET, Socket::SOCK\_RAW, Socket::IPPROTO\_RAW)
> 
> anyone have an explination?

I have the same but with ruby 1.8.5

Maybe it is related to this:

> **[Raw Sockets Gone in XP SP2](http://www.interact-sw.co.uk/iangblog/2004/08/12/norawsockets)**
>
> Ian Griffiths' Weblog

Anyway - with linux the code raises the exception with my standard user  
(which I think is sensible)

Errno::EPERM: Operation not permitted - socket(2)

and returns a socket when run as root

=\> #Socket:0x2afa764df288

Some of the posts (your favourite search engine will have bunches of  
hits) did suggest that disabling firewall and firewall-service will  
reenable raw-sockets, but I didn’t try this.

Sorry, I do not have a solution - only a possible explanation.

Stefan
