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.

buddy1313

Member Since 23 Jan 2014
Offline Last Active Jun 02 2014 07:46 PM
-----

#56642 NeonMika.Webserver

Posted by buddy1313 on 05 March 2014 - 01:20 PM

Thank you for your reply and assistance Markus. I added a Debug print at the beginning of my newIP method like so to see if it was even getting called:

  public void newIP(Request e, Hashtable h)
        {
            Debug.Print("newIP was called");
            String ipAddress = "";
            String subnetMask = "";
            String gateWay = "";

And it wasn't. This is the output I got after using the above URL, including the exceptions you wanted to see:

 

Client connected
URL: newIP
Final byte count: 506
 
A first chance exception of type 'System.IO.IOException' occurred in Microsoft.SPOT.IO.dll
A first chance exception of type 'System.IO.IOException' occurred in Microsoft.SPOT.IO.dll
Sent 404 Not Found
Reqeust finished
 
I think there may be a chance I don't have the library set up properly to make modifications to it. As I said before I'm still new to c#, visual studio, and network code. I have two projects set up, one from your WebserverExecutable and one from your Webserver. I modify the code in Webserver, rebuild it after the changes I make, then I delete the reference to NeonMika.Webserver in the WebserverExecutable project and remake the reference to the newly rebuilt .dll file for the Webserver. Is that the proper way to make the changes I'm trying to implement to the library? It feels like I'm missing something.
 
I want to be able to change the IP of my netduino over the network so it can be managed remotely. It is actually being potentially used on a pretty large scale project for my employer. If I can get the devices to perform as needed, there may be as many as 100 netduinos deployed in one of our shops. Each will be attached to an RFID reader and will be hooked up to a controller for a manufacturing cell that makes parts. Our operators will have an RFID card given to them that will be read by the netduino to have the machine select the appropriate die set for their part and will tell the netduino how to collect data for the particular parts we're making. We need to be able to configure almost everything about the netduino remotely, as making changes to so many units locally would be tedious. It's a pretty cool project! I'd be more than happy to keep you up to date on how it turns out.



#56619 NeonMika.Webserver

Posted by buddy1313 on 04 March 2014 - 01:45 PM

Hello Markus,

 

Thank you very much for sharing your library. I've been learning a lot about networking and c# code.

 

I'm trying to modify your library so that the static IP address of the netduino could be changed through the browser. I'm still new to c# and networking code in general, so this is proving quite difficult for me. I've tried adding the following expansion method to the server class and adding it to the server via your AddResponse method.

public void newIP(Request e, Hashtable h)
        {
            String ipAddress = "";
            String subnetMask = "";
            String gateWay = "";
            if (e.GetArguments.Contains("ip") == true)
            {
                if (e.GetArguments.Contains("subnet") == true)
                {
                    if (e.GetArguments.Contains("gateway") == true)
                    {
                        ipAddress = "" + e.GetArguments["ip"];
                        subnetMask = "" + e.GetArguments["subnet"];
                        gateWay = "" + e.GetArguments["gateWay"];
                    }
                }
            }
            h.Add("ip", ipAddress);
            h.Add("subnet", subnetMask);
            h.Add("gateway", gateWay);
            var interf = NetworkInterface.GetAllNetworkInterfaces()[0];
            interf.EnableStaticIP(ipAddress, subnetMask, gateWay);
        }

After sending the server the following:

 

http://netduinoplus/...eway=10.4.100.1

 

I get two System.IO.IOExceptions. Hopefully what I would like to accomplish is pretty easy and I'm just misguided.

 

Thanks again for this awesome library!

 

-Michael




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.