Forum: Ruby Crash when using sockets

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
23b896ac85310380e1d64048c7464c30?d=identicon&s=25 First Last (igotzaquestion)
on 2007-07-25 23:51
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?
428f96cc689eb7419bba3a8bbfcc222a?d=identicon&s=25 Stefan Mahlitz (Guest)
on 2007-07-26 22:43
(Received via mailing list)
First Last 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:

http://www.interact-sw.co.uk/iangblog/2004/08/12/n...

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
This topic is locked and can not be replied to.