[Ironruby-core] Socket test

Peter Bacon Darwin bacondarwin at googlemail.com
Fri May 9 07:38:18 EDT 2008

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.

	require 'socket'

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

or perhaps more correctly

	require 'socket'
rescue LoadError


-----Original Message-----
From: ironruby-core-bounces at rubyforge.org
[mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of C.J. Adams-Collier
Sent: Friday,09 May 09, 2008 12:18
To: ironruby-core at rubyforge.org
Subject: [Ironruby-core] Socket test

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

cjcollier at karma:/usr/src/svn/rubyforge.org/ironruby/trunk/tests/ 
ironruby$ cat socket-test.rb && echo '===' && ruby socket-test.rb
require 'socket'
streamSock = TCPSocket.new( "", 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
Ironruby-core at rubyforge.org

More information about the Ironruby-core mailing list