[Ironruby-core] Patch submission - sockets
sanxiyn at gmail.com
Thu Jan 10 19:06:50 EST 2008
2008/1/11, Terence Lewis <lewistm at gmail.com>:
> 2) Regarding the ConvertToPort function (which is currently
> incorrectly spelled with only 1 t in the middle), there is a function
> in the winsock dll called getservbyname which will do this conversion
> for you - unfortunately it's not exposed to .NET at all as far as I
> can tell. It's also exposed directly by Ruby's socket class as the
> method "getservbyname", so we are going to need to call it. I've
> written a simple P/Invoke call which will call into ws2_32.dll to get
> this information, but I realized only after almost finishing the code
> that you guys may want to steer clear of P/Invoke for compatibility
> reasons. Is that true and if so, how can I go about implementing this
> function manually - does anybody know where I can get a list of what
> it can return? If not (i.e p/invoke is OK), does something special
> have to be done to make that code work on mono? I thought I'd get an
> answer on these questions before tidying up my code and submitting it.
In theory, getservbyname returns IANA-specified port numbers.
In practice, implementing common ports like FTP and HTTP would suffice.
Re: P/Invoke. You need to specify the different DLL name, otherwise
it's same. In this case, socket functions are in libc, So
More information about the Ironruby-core