On multicast: are you wanting to subscribe to multicast groups?
I've always wanted to make my device SSDP-discoverable. In order to do that, I need to be able to join a multicast group, with code something like:
Dim ipAddr As Byte() = localaddress.GetAddressBytes() Dim multicastOpt As Byte() = New Byte() {discoveryAddr(0), discoveryAddr(1), discoveryAddr(2), discoveryAddr(3), ipAddr(0), ipAddr(1), ipAddr(2), ipAddr(3)} mobjSearchListenerSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, True) mobjSearchListenerSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastInterface, True) mobjSearchListenerSocket.Bind(New IPEndPoint(IPAddress.Any, 1900)) ' This line fails on Netduino 4.2 RC5 mobjSearchListenerSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, multicastOpt)
So thats what I was asking about RE multicast.
My question on the number of sockets: My use case is that the "client" software is web-based and uses web sockets. So each connected (web socket) client would use up a socket pretty much permanently, and the web software is served up to the end user browser via a web server. Modern browsers tend to open multiple connections at once for CSS/JS files, etc so I end up getting connection failures pretty easily. So I am not after the ability to turn the Netduino into a web server exactly, but I do want to be able to successfully serve up the client software.
I set the cache-control headers so that the files are only served up once - but I still need them to be served up on the initial request successfully. And if you add a connection to a time server and an SSDP listener, theres another two sockets gone. So with a total of 8 sockets, I lose 3 to SSDP/NTP/HTTP listener, then when my first client connects and opens a web socket, there's another one gone, leaving me with only 4 sockets. Once a second client connects, theres another (web) socket gone, leaving me with 3, and most likely limiting me to one concurrent client at once, we web browser tend to open 3 or 4 connections.
The reason that I am serving up the files from the Netduino is to avoid the need for internet connectivity, and to avoid the potential for XSS protection from throwing security exceptions on the browser side.
What's the reason for only 8 sockets? Is it a memory limitation on the CC3100?