Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Support for UDP Multicast?


  • Please log in to reply
9 replies to this topic

#1 Mercer

Mercer

    Member

  • Members
  • PipPip
  • 17 posts

Posted 17 April 2012 - 03:50 AM

Is support for multicast planned? If so, can I use the SocketOptionName methods? I am looking forward to checking out the Netduino Go, but I need multicast support. The following is a segment of code I am currently using on the PC that I would like to port to the Netduino.

   NetworkInterface.EnableStaticIP(ip, subnet, gateway, mac);
   NetworkInterface.EnableStaticDns(new byte[] { 192, 168, 1, 1 });
   Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
   
   socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastInterface, multicastIPAddress.GetAddressBytes());
   socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, 1);
   
   IPAddress DestinationIP = new IPAddress(new byte[] { 239, 255, 0, 1 });
   IPEndPoint DestinationEndPoint = new IPEndPoint(DestinationIP, 5568);


#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 17 April 2012 - 04:58 AM

Hi Mercer, Since we have more flash and RAM on Netduino Go, we may be able to support this...as long as NETMF supports it. Chris

#3 Mercer

Mercer

    Member

  • Members
  • PipPip
  • 17 posts

Posted 11 December 2012 - 04:05 AM

Hi Mercer,

Since we have more flash and RAM on Netduino Go, we may be able to support this...as long as NETMF supports it.

Chris


Hello Chris,

I finally got around to testing this with the N2+. When I call SetOption, I get the following error

A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll
An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll


   socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastInterface, multicastIPAddress.GetAddressBytes());  //Fails
   socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, 1);  // Fails
   socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true); // Works

Any idea why this is failing or if this could be addressed in a future release? I believe NETMF supports this, but not sure. Thanks.

#4 Valkyrie-MT

Valkyrie-MT

    Advanced Member

  • Members
  • PipPipPip
  • 315 posts
  • LocationIndiana, USA

Posted 11 December 2012 - 06:26 PM

Is support for multicast planned?


mIP could be modified to do generic UDP multicast. Right now mIP does multicast for the mDNS implementation. All the code is C# too. The only hiccup is getting a firmware build without the Ethernet compiled in. Chris, what would happen if someone loaded the NetduinoGo firmware on the N2+ ?

See mip.codeplex.com

-Valkyrie-MT

#5 Mercer

Mercer

    Member

  • Members
  • PipPip
  • 17 posts

Posted 17 December 2012 - 11:19 PM

mIP could be modified to do generic UDP multicast. Right now mIP does multicast for the mDNS implementation. All the code is C# too. The only hiccup is getting a firmware build without the Ethernet compiled in. Chris, what would happen if someone loaded the NetduinoGo firmware on the N2+ ?

See mip.codeplex.com

-Valkyrie-MT


Thanks Valkyrie for the suggestion.

#6 Mercer

Mercer

    Member

  • Members
  • PipPip
  • 17 posts

Posted 17 December 2012 - 11:21 PM

When I call SetOption, I get the following error A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastInterface, multicastIPAddress.GetAddressBytes()); //Fails socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, 1); // Fails socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true); // Works Any chance of getting this fixed/added in future releases?

#7 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 18 December 2012 - 12:00 AM

Hi Mercer, Is this code which works on some other NETMF board? If NETMF supports it and turning on the feature won't overflow the RAM, we could certainly support it. If it's not something which NETMF supports, we can request that it be added (or add it as a community and contribute it to the netmf.codeplex.com core). Chris

#8 mackelen

mackelen

    Member

  • Members
  • PipPip
  • 10 posts
  • LocationVeghel - Netherlands

Posted 18 December 2012 - 04:08 PM

What are you trying to accomplish with the multicast ? Is it just to do a local broadcast of an UDP message ? Or is it something else ?

#9 flkendall

flkendall

    New Member

  • Members
  • Pip
  • 3 posts

Posted 21 December 2012 - 02:55 AM

I also have an interest in multicast. I'm working to build robot model satellites using software that commands actual satellites. The handshaking between software modules is already multicast. I’m hoping to piggyback off the existing communications protocols. I have C# code that I’ve used on Windows phones that has worked well for me in the past. I’ve tried using Framework 4.1 and 4.2 with same results mentioned here. Please advise!

#10 Mercer

Mercer

    Member

  • Members
  • PipPip
  • 17 posts

Posted 22 December 2012 - 06:00 AM

Hi Mercer,

Is this code which works on some other NETMF board? If NETMF supports it and turning on the feature won't overflow the RAM, we could certainly support it.

If it's not something which NETMF supports, we can request that it be added (or add it as a community and contribute it to the netmf.codeplex.com core).

Chris



Chris.

I did some testing on another board, and the following code works as expected.

            Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastInterface, multicastIPAddress.GetAddressBytes());
            socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, 1);

            IPAddress DestinationIP = new IPAddress(new byte[] { 239, 255, 0, 1 });
            IPEndPoint DestinationEndPoint = new IPEndPoint(DestinationIP, 5568);

So, it looks like this could be supported in future releases and would make a great addition. Thank you for considering.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.