Currently the Socket library is part of the IronRuby.Libraries.dll, which is
all loaded up on start-up automatically.  So you don't need to do a require
'socket' before the TCPSocket class is available.
If you want to write a program that will work on both IronRuby and other
flavours of Ruby then you can do the following at the top of your file.

begin
        Socket
rescue
        require 'socket'
end

which is what appears in my RSpec socket tests at the moment

or perhaps more correctly

begin
        require 'socket'
rescue LoadError
end

Regards,
Pete

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of C.J. Adams-Collier
Sent: Friday,09 May 09, 2008 12:18
To: [email protected]
Subject: [Ironruby-core] Socket test

Here's a test of the socket patch from Mono at r100:

[EMAIL PROTECTED]:/usr/src/svn/rubyforge.org/ironruby/trunk/tests/ 
ironruby$ cat socket-test.rb && echo '===' && ruby socket-test.rb
require 'socket'
streamSock = TCPSocket.new( "127.0.0.1", 20000 )
===
IronRuby.Libraries:0:in `Require': Could not load file or assembly  
'socket' or one of its dependencies. The system cannot find the file  
specified. (LoadError)

Is this a user error?  Should I add something to the MONO_PATH?
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to