Mike,

> I'm wanting to access the SocketCAN (Controller Area Network)
infrastructure from Mono.
> SocketCAN is part of the kernel networking infrastructure.
> It uses the standard sockets system calls with address family being
set to AF_CAN (29) and protocol family set to PF_CAN (29).
> Is there a way of extending the AddressFamily and ProtocolFamily
values to use the above?

I ran into a similar issue when trying to use Bluetooth in Linux. The
native socket interface supports it, but Mono catches an unknown
protocol type and returns an exception before it gets down to that
level. I patched around it in socket-io.c by disabling Mono's checks and
letting it hand the values directly down to the OS. If you get something
wrong, you'll still know about it because you'll get an exception from
the failed system call. I believe the reason that this isn't the default
behavior is that there is not a 1:1 mapping of Linux socket errors to
the exceptions that are supposed to be thrown in various circumstances.
If Mono didn't pre-filter the address types and protocol families, then
its exception results for bad values would differ from those on .NET
(possibly breaking applications that relied on catching specific
exceptions). 

But that's just my guess. The patch is a couple months old, so I'm not
even sure if it will apply correctly, just thought I'd show you where I
started when facing the same issue. Good luck.

-Thad

Attachment: socket-io.patch
Description: socket-io.patch

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to