[Mono-dev] Mono C# + IOCTL
rdynm at yahoo.com
Sat Dec 13 22:56:47 EST 2008
Yea I just used pseudo code. The problem is that mono c# does not support PF_PACKET so the only way around it
is to pretty much implement it from scratch using marshaling and unamanged code imports. I'm half way there my code looks
something like that for now:
public static extern int socket(int domain, int type, int protocol);
public static extern int send(int s, [MarshalAs(UnmanagedType.LPArray)] byte buf, int len, int flags);
public static extern int recv(int s, [MarshalAs(UnmanagedType.LPArray)] byte buf, int len, int flags);
This allows me to create the socket and send/recv data. Still need to implement bind.
I wish there was a way to link that fd returned by socket to the native c# socket class but up to my knowledge there isn't.
From: Gonzalo Paniagua Javier <gonzalo.mono at gmail.com>
To: Alex <rdynm at yahoo.com>
Cc: mono-devel-list at lists.ximian.com
Sent: Saturday, December 13, 2008 10:38:37 PM
Subject: Re: [Mono-dev] Mono C# + IOCTL
On Thu, 2008-12-11 at 19:26 -0800, Alex wrote:
> Just tried it out, it produced an exception.
> Unhandled Exception: System.Net.Sockets.SocketException: Bad address
> Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Raw,
> s.IOControl(0x8933, null, null);
This is not the way to use ioctl in C. You need additional parameters.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-devel-list