[Ironruby-core] Code Review: socket2

Peter Bacon Darwin bacondarwin at googlemail.com
Wed May 7 05:19:58 EDT 2008

The .NET Socket library is a fairly thin layer that sits on top of WinSock.
Clearly Silverlight would not be able to do this since WinSock is not a
standard API on other OSes. Also, Silverlight is going to have additional
security restrictions that would prevent much of the Socket library from
work anyway.

To be honest, even the full .NET Framework socket implementation does not
fully support all the features required by the Ruby socket library.  I have
been struggling to get the Socket class working - it is not pretty.

This is partly to do with the way the Ruby socket library is implemented.
In particular, the Socket class provides access to low level C API methods,
which differ from system to system.  In the best case this results in
slightly inconsistent behaviour and different errors being raised.  In the
worst case it is not possible to write portable Ruby code that uses the
socket library, unless you restrict yourself to well defined methods.

It seems reasonable that, since the Ruby Socket library is somewhat OS
dependent anyway, we should agree upon a subset of the functionality to
support, particularly with regards to Silverlight.  Perhaps this should be
based upon common usage in programs like Mongrel?  I suspect that like many
of these things, we may end up having to code up some stuff in straight .NET
(is this possible with socket-type things?)


John Lam wrote:
> Specifically on your contribution, I'm having a heck of a time getting it
to compile under Silverlight. I'm going to block off some more time tomorrow
> to see what I can do. Sockets are only partially implemented in
Silverlight, so I have to figure out the delta. Don't worry about making
changes - once > I get it compiling under SL, I'll check it in and you can
modify my changes :)


Ironruby-core mailing list
Ironruby-core at rubyforge.org

More information about the Ironruby-core mailing list