webserver with static ip address
#1
Posted 06 December 2012 - 07:04 AM
#2
Posted 06 December 2012 - 03:33 PM
It is part of the .NetMF SDK installation, and you can reach it from the Start menu:
start -> all programs -> microsoft .net micro framework 4.2 -> tools
this is actually a folder link which will open up the folder containing various .netmf4.2 tools, amongst which is the MFDeploy.exe.
There is also a help file that details it's usage, but the short story for your purspose is to set 'device' to 'usb' (which should then show 'NetduinoPlus2_Netduino' if it successfully connects),
and then:
Target -> Configuration -> Network
will bring up a dialog box with the various networking options.
Once you set this to your choosing, you should be good.
Well, except for one caveat:
* a bug in pre 4.2.1.2 firmware ignores these settings
You can see your firmware version via
Target - > Device Capabilities
which will spew forth many interesting things, including a line starting with:
SolutionReleaseInfo.solutionVersion
which should show at least 4.2.1.2 to be free of the bug. This is a very recent firmware fix at the time of this writing, so you probably need it if you haven't explicitly updated your board. There's a separate (pinned) thread in this topic on how to perform that update. (I don't know how to link or else I would, but you can find it easily).
-rave
#3
Posted 06 December 2012 - 03:46 PM
#4
Posted 06 December 2012 - 03:49 PM
#5
Posted 06 December 2012 - 05:01 PM
In the Program.cs file you have the following line:
Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].EnableDhcp();
This is what enables DHCP.
To use Static IP use this code in place of the above line.
var interf = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0]; interf.EnableStaticIP("<staticIP>", "<subnetmask>", "<gateway>"); interf.EnableStaticDns(new string[] { "<primaryDNS>", "<secondaryDNS>" });
replace all of the <> with the appropriate settings for your network.
- Irma Nirmalasari likes this
#6
Posted 06 December 2012 - 05:43 PM
thanks dave,If I understand you correctly you are looking to dynamically set up your Netduino for a Static IP and not use DHCP.
In the Program.cs file you have the following line:
Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].EnableDhcp();
This is what enables DHCP.
To use Static IP use this code in place of the above line.
var interf = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0]; interf.EnableStaticIP("<staticIP>", "<subnetmask>", "<gateway>"); interf.EnableStaticDns(new string[] { "<primaryDNS>", "<secondaryDNS>" });
replace all of the <> with the appropriate settings for your network.
i change code with the ones you send me but still when i open browser and point to this address i got internet explorer can not display webpage what do you think ??? i still can ping the board
#7
Posted 06 December 2012 - 05:54 PM
dave,If I understand you correctly you are looking to dynamically set up your Netduino for a Static IP and not use DHCP.
In the Program.cs file you have the following line:
Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].EnableDhcp();
This is what enables DHCP.
To use Static IP use this code in place of the above line.
var interf = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0]; interf.EnableStaticIP("<staticIP>", "<subnetmask>", "<gateway>"); interf.EnableStaticDns(new string[] { "<primaryDNS>", "<secondaryDNS>" });
replace all of the <> with the appropriate settings for your network.
could you please review WebServer.cs class i think there are some lines must be change also as i think could you review it
#8
Posted 06 December 2012 - 05:57 PM
#9
Posted 06 December 2012 - 06:08 PM
dave,
could you please review WebServer.cs class i think there are some lines must be change also as i think could you review it
I just made the same 3 line change and deployed this to my Netduino Plus and it ran perfect. There are no issues with the code. If it is not working, the problem is either in your settings or your network.
#10
Posted 06 December 2012 - 06:16 PM
dave,I would double check your network settings. Make sure the IP address of the Netduino and the IP of the computer you are using to access it are on the same subnet. Be sure the subnet mask is the same.
Next you should put a breakpoint on the line of code where the request is handled and run in debug mode. If the request is hitting the netduino it should execute this code.
i double check all settings it is ok netmask the same , could you explain how to put breakpoint for debugging issue , sorry i am new in netduino
#11
Posted 06 December 2012 - 06:45 PM
dave,dave,
i double check all settings it is ok netmask the same , could you explain how to put breakpoint for debugging issue , sorry i am new in netduino
if you review webserver.cs you can see there are multiple debug.print commands which display status at different points
but all what i got on debug o/p is the ip address of the board i think this out from this command
Debug.Print(Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].IPAddress);
#12
Posted 06 December 2012 - 07:20 PM
dave,
if you review webserver.cs you can see there are multiple debug.print commands which display status at different points
but all what i got on debug o/p is the ip address of the board i think this out from this command
Debug.Print(Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].IPAddress);
This likely means the request is never getting to the board through the network.
#13
Posted 06 December 2012 - 07:28 PM
dave,This likely means the request is never getting to the board through the network.
did you suggest specific diagonestic steps
#14
Posted 07 December 2012 - 06:59 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users