#138 √ resolved
gnufied

[BUG] Socket API inconsistent with MRI

Reported by gnufied | November 17th, 2007 @ 05:42 AM | in 1.0

require "socket"

lol = TCPSocket.open("localhost",11001)

Throws:

An exception has occurred:

wrong number of arguments (got 2, required 1) (ArgumentError)

Backtrace:

TCPSocket.open at kernel/core/io.rb:0

main.__script__ at use_socke.rb:3

CompiledMethod#as_script at kernel/bootstrap/primitives.rb:41

main.load at kernel/core/compile.rb:95

main.__script__ at kernel/loader.rb:190

Now, for this:

spc = TCPSocket.new("localhost",11001)

An exception has occurred:

Unable to set socket option (Protocol not available) (ENOPROTOOPT)

Backtrace:

Errno.handle at /home/gnufied/checkout/code/lib/socket.rb:22

BasicSocket(TCPSocket)#setsockopt at /home/gnufied/checkout/code/lib/socket.rb:71

Now,for this:

lol = TCPSocket.new("localhost",11001,true)

p lol.gets

it returns nil.

Comments and changes to this ticket

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket