I'm trying to cobble together the parts & code needed to have the netduino act as a web server over WiFi. My end goal is to allow my robot to be controlled / receive commands from Windows Phone 7 device (which can only make http requests; no sockets here). Just as a note I have the original netduino, not the plus model. I was planning to use an XBee shield for WiFi as it appears to have been used successfully by others in this forum. The final missing piece of the puzzle will be to have the netduino listen for http requests and produce some kind of output (and, optionally, return some response data to the device making the requests). I found some code to host a web server from a previous post here http://forums.netdui...ch__1#entry3685 :
WebServer webServer = new WebServer();
while (true)
{
int requestLength = webServer.WaitForRequest(new RequestReceivedDelegate(RequestReceived));
if (requestLength > 0)
{ //-- Build response --
responseStr = "HTTP/1.1 200 OK\nContent-Type: text/html\n\n";
responseStr += ProcessRequest(receivedStr);
// IMPORTANT: SendResponse() sends response AND closes the connection, please call only once per request.
webServer.SendResponse(responseStr);
receivedStr = "";
}
Thread.Sleep(100);
}}
Here I'm assuming / hoping the WebServer class is either part of the .NET Micro Framework or part of the example code from the previous post (I guess I should read that code . My question is would this work on the original netduino or do I need to upgrade to the plus - and does the overall solution for communicating wirelessly with WP7 sound like the right direction to go? Thanks!!
Hello James,
To use a netduino with wireless, you don't need the plus version. But you need a wireless shield. Xbee module doesn't use the same wireless techonlogies than your PC or Mobile. PC and Mobile use a wireless named Wi-Fi, which use 802.11() wireless technology. With this technology, it's possible to use a IPv4 stack over it, and use HTTP protocol. XBee modules use a different wireless technology, 802.15.4. This technology is perfect is case of low power needs. But, the frame size is 128 bytes only, so it's impossible to use IPv4 over it. Some IPv6 stack exists using 6lowPAN.
In conclusion :
- Use XBee on Netduino and another XBee on your PC. And forget Mobile use. This is a point to point communication. Like serial over the air.
- Or use a true Wi-Fi 802.11 shield, but you probably need to write a driver for it
Pascal