[Mono-dev] Non-TCP/IP socket access
Robert Jordan
robertj at gmx.net
Fri Jul 22 09:40:43 EDT 2011
On 22.07.2011 15:00, Andy Hume wrote:
>> From: mono-devel-list-bounces at lists.ximian.com
>> [mailto:mono-devel-list-bounces at lists.ximian.com] On Behalf
>> Of Robert Jordan
>> Sent: 22 July 2011 12:43
>> To: mono-devel-list at lists.ximian.com
>> Subject: Re: [Mono-dev] Non-TCP/IP socket access
>>
>> On 22.07.2011 13:08, Andy Hume wrote:
>>> Presumably I can't convert my fd to a wapi handle somehow... So is
>>> that plan not going to work? :-,(
>>
>> It won't work. The whole socket machinery assumes type
>> AF_UNIX or AF_INET. If you set a fd of some other address
>> family type, a lot of nasty things could happen if this check
>> wasn't there.
>>
>> Get/SetSocketOptions, Local/RemoteEndPoint etc. simply don't
>> cope with other AF types. They would return garbage at best.
>>
> I actually don't need to call any of those functions -- and if I were I
> could just P/Invoke them...[1] :-,(
>
> The bit I obviously don't want to have to write myself is anything to do
> with I/O. That's a huge amount of difficult work and its all there and
> working in Mono and would work for my (SOCK_STREAM) socket if I could
> just create the socket somehow. :-,(
>
> All I need is that wapi handle...[2] Do we think it's impossible to
> access it.
It looks like you could be able to create the socket with
io-layers's function:
[DllImport("__Internal")]
static extern int _wapi_socket(int domain, int type,
int protocol, IntPtr unused1, int unused2, int unused3);
Then assign the returned descriptor via reflection.
I'll be shot for this one day ;)
Robert
More information about the Mono-devel-list
mailing list