[Mono-dev] .NET / Mono runtime multi-cast differences.

Alan McGovern alan.mcgovern at gmail.com
Mon Aug 24 03:56:24 EDT 2009


Unless I'm missing something, you haven't actually described what the
problem is. Nor have you mentioned what exactly happens on windows, what
happens on linux and what you actually expected to happen. Your example also
appears to be missing information which might help figure out what issue it
is you're seeing, what are listenChannel and listenEndpoint?


On Mon, Aug 24, 2009 at 3:20 AM, James P Michels III <
james.p.michels at gmail.com> wrote:

> I have observed a difference in behavior between the Mono runtime and
> .NET runtime with respect to multi-cast support.
> Unless the Socket.Bind operation is modified to bind to a different end
> point based on the runtime, no packets will be received. The workaround
> that I am using is shown in the attached code section.
> I took a look at Mono's source code. Additionally, I wrote a short C
> program with the equivalent functionality. The C version for Linux
> exhibits the same behavior. It is my impression that the behavior is due
> to differences between the Windows socket implementation and the Linux
> socket implementation. It is also my impression that these differences
> are being realized by both the .NET and Mono runtime which ultimately
> consume them.
> I have 2 questions.
> 1) Am I wrong? Is there a runtime agnostic way to do this? (Binding to
> IPAddress.Any does not work on Windows to my knowledge)
> 2) If I am not wrong, what steps, if any, should be taken to resolve
> these differences?
> Thanks
> Jim
> ---------begin code sample------------
>        listenSocket = new Socket(AddressFamily.InterNetwork,
> SocketType.Dgram, ProtocolType.Udp);
>        listenSocket.SetSocketOption(SocketOptionLevel.Socket,
> SocketOptionName.ReuseAddress, true);
>        if (IsMonoRuntime())
>        {
>            listenSocket.Bind(listenChannel);
>        }
>        else
>        {
>            listenSocket.Bind(listenEndpoint);
>        }
>        listenSocket.SetSocketOption(SocketOptionLevel.IP,
> SocketOptionName.MulticastInterface, listenInterface.GetAddressBytes());
>        listenSocket.SetSocketOption(SocketOptionLevel.IP,
> SocketOptionName.AddMembership, new
> MulticastOption(listenChannel.Address, listenInterface));
> ---------end code sample------------
> _______________________________________________
> Mono-devel-list mailing list
> 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/20090824/23a76819/attachment.html 

More information about the Mono-devel-list mailing list