Socket.connect not defined?

Hi all,

Here is a dump from a jirb session on Windows 7 (64):

irb(main):001:0> require ‘socket’
=> true
irb(main):002:0> include Socket::Constants
=> Object
irb(main):003:0> socket = Socket.new(AF_INET, SOCK_STREAM, 0)
=> #Socket:0x47e7d503
irb(main):004:0> address = Socket.sockaddr_in(80, “localhost”)
=> “\002\000\000P\177\000\000\001\000\000\000\000\000\000\000\000”
irb(main):005:0> socket.connect(address)
NoMethodError: undefined method `connect’ for #Socket:0x47e7d503
from (irb):6

jruby -v:
jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2009-11-02 69fbfa3) (Java
HotSpot™ 6
4-Bit Server VM 1.6.0_17) [amd64-java]

Am I missing something?

Please advise.

Thanks.

This method has since been added since JRuby 1.4.0. It will be in
1.5.0 release or you can grab a nightly here:
http://ci.jruby.org/job/jruby-dist/ … or you can build it from
source if you have ant installed.

-Tom

On Mon, Mar 29, 2010 at 4:19 PM, Luc T.
[email protected] wrote:

irb(main):005:0> socket.connect(address)
Luc T.


blog: http://blog.enebo.com twitter: tom_enebo
mail: [email protected]


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Mar 29, 2010, at 2:19 PM, Luc T. wrote:

irb(main):004:0> address = Socket.sockaddr_in(80, “localhost”)

Please advise.

Thanks.


Luc T.

Socket#connect and Socket#connect_nonblock was added in a8981dec on
January 14, 2010.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs