[Mono-dev] Patch for NetworkInformation on OSX

Miguel de Icaza miguel at xamarin.com
Thu Jun 5 16:36:38 UTC 2014


It does not matter, this is already abstracted per platform

On Thursday, June 5, 2014, Bryan Crotaz <bryan.crotaz at silvercurve.co.uk>
wrote:

> Does it work on Linux and windows? Or does it fall back to the old
> behaviour? Or does it throw nasty errors?
>
> Bryan Crotaz
> Silver Curve
>
> On 5 Jun 2014, at 11:41, "Hüning, Christian" <
> Christian.Huening at haw-hamburg.de> wrote:
>
>  Hi everybody,
>
> I just ran into a problem regarding the usage of
> System.Net.NetworkInformation.NetworkInterface.cs on OSX. Especially the
> Properties „SupportsMulticast“ and „OperationalStatus“ were not implemented
> properly (always returning false / unknown). So I just fixed that.
>
> On http://mono-project.com/Contributing#Ways_to_Contribute it’s written
> to post patches to this mailing list, so I do :)
>
> My solution basically works by extracting the ifa_flags via getifaddrs and
> storing the flags in the MacOsNetworkInterface class inside of
> NetworkInterface.cs. I can then implement the two properties like so:
>
> public override OperationalStatus OperationalStatus {
>             get {
>                 if(((MacOsInterfaceFlags)_ifa_flags & MacOsInterfaceFlags.
> IFF_UP) == MacOsInterfaceFlags.IFF_UP){
>                     return OperationalStatus.Up;
>                 }
>                 return OperationalStatus.Unknown;
>             }
>         }
>
>         public override bool SupportsMulticast {
>             get {
>                 return ((MacOsInterfaceFlags)_ifa_flags &
>  MacOsInterfaceFlags.IFF_MULTICAST) == MacOsInterfaceFlags.IFF_MULTICAST;
>             }
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> <javascript:_e(%7B%7D,'cvml','Mono-devel-list at lists.ximian.com');>
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20140605/17f39373/attachment.html>


More information about the Mono-devel-list mailing list