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

webserver with static ip address


  • Please log in to reply
13 replies to this topic

#1 ASM71

ASM71

    Advanced Member

  • Members
  • PipPipPip
  • 35 posts

Posted 06 December 2012 - 07:04 AM

hello, i am trying to build a web server with static ip address as example explained in forums webserver helloworld but i can not see the page on browser i use mfdeploy to set fixed ip to netduino board and compile the program but no thing work attached is the code

Attached Files



#2 ziggurat29

ziggurat29

    Advanced Member

  • Members
  • PipPipPip
  • 244 posts

Posted 06 December 2012 - 03:33 PM

MFDeploy is not a browser based tool; rather it is a destop native application accesses the CLRon our board via USB (typcially, but certainly with the NP2).


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 ASM71

ASM71

    Advanced Member

  • Members
  • PipPipPip
  • 35 posts

Posted 06 December 2012 - 03:46 PM

Hi, I am using custom firmeware 4.1.1b1 which support 1 wire devices so is there a problem to deploy on this ver

#4 ASM71

ASM71

    Advanced Member

  • Members
  • PipPipPip
  • 35 posts

Posted 06 December 2012 - 03:49 PM

Hi, When i set ip using mfdeploy i can ping board what i ask for is the modification on program to accept static ip not to obtain from dhcp

#5 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 06 December 2012 - 05:01 PM

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.

#6 ASM71

ASM71

    Advanced Member

  • Members
  • PipPipPip
  • 35 posts

Posted 06 December 2012 - 05:43 PM

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.

thanks dave,
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 ASM71

ASM71

    Advanced Member

  • Members
  • PipPipPip
  • 35 posts

Posted 06 December 2012 - 05:54 PM

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.

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

#8 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 06 December 2012 - 05:57 PM

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.

#9 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

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 ASM71

ASM71

    Advanced Member

  • Members
  • PipPipPip
  • 35 posts

Posted 06 December 2012 - 06:16 PM

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.

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

#11 ASM71

ASM71

    Advanced Member

  • Members
  • PipPipPip
  • 35 posts

Posted 06 December 2012 - 06:45 PM

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

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);

#12 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

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 ASM71

ASM71

    Advanced Member

  • Members
  • PipPipPip
  • 35 posts

Posted 06 December 2012 - 07:28 PM

This likely means the request is never getting to the board through the network.

dave,
did you suggest specific diagonestic steps

#14 ASM71

ASM71

    Advanced Member

  • Members
  • PipPipPip
  • 35 posts

Posted 07 December 2012 - 06:59 PM

Why the request did not reach or hit the board even i can ping it from pc




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.