[Mono-dev] Non-TCP/IP socket access

Robert Jordan robertj at gmx.net
Fri Jul 22 12:12:17 EDT 2011

On 22.07.2011 18:04, Ivo Smits wrote:
> Op 22-7-2011 17:05, Andy Hume schreef:
>> That was the most beautiful ugly thing I've seen in a long time. :-)
>> Unfortunately I haven't managed to get it to work:
>> 1) Try [DllImport("__Internal")] extern int _wapi_socket(..)
>> Swallowed Exception: System.EntryPointNotFoundException: _wapi_socket
>> 2) Try [DllImport("mono-2.0")] extern int _wapi_socket(..)
>> Swallowed Exception: System.EntryPointNotFoundException: _wapi_socket
> If I remember correctly, the class name including it's namespace may
> need to be the same. I have used a similar 'hack' with the file I/O to
> create an unbuffered stream I/O wrapper. I've used the
> [MethodImplAttribute(MethodImplOptions.InternalCall)] attribute there;

We don't want the internal call because... see below.

> just copy-pasted from the Mono sourcecode. Also, shouldn't the return
> value be an IntPtr rather than an int?

The return value is 32 bit.

> However, looking at the mono code, there are no checks in the managed
> part of the Socket construction. Did I miss anything, is it in the
> unmanaged code perhaps? Have you tried to use the managed Socket

There are checks. That's the whole point.


More information about the Mono-devel-list mailing list