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

Getting Started with Netduino: Connecting to the Internet


  • Please log in to reply
14 replies to this topic

#1 Dan Kowalczyk

Dan Kowalczyk

    Advanced Member

  • Members
  • PipPipPip
  • 44 posts
  • LocationSeattle

Posted 28 October 2012 - 02:45 AM

I just finished reading chapter 8 of Getting Started with Netduino and downloaded the example code. After making a physical Ethernet connection between my board and my router, I ran the program and it output the IP address of the Netduino. When I type the IP address into my browser, it can't connect. What am I missing?
If you want a treat and don't mind the treatment...

#2 Dan Kowalczyk

Dan Kowalczyk

    Advanced Member

  • Members
  • PipPipPip
  • 44 posts
  • LocationSeattle

Posted 28 October 2012 - 04:09 AM

I've also been trying to follow examples from Getting Started with the Internet of Things with no success either. I tried disabling DHCP and using a static IP with no luck. I just ran the diagnostic test provided on the Internet of Things website and got the following error: Trying to connect to www.google.com... in Connect resolving the host name (can take a minute or so!)... #### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (1) #### #### Message: #### Microsoft.SPOT.Net.SocketNative::getaddrinfo [IP: 0000] #### #### System.Net.Dns::GetHostEntry [IP: 0008] #### #### GsiotDiagnostics::Connect [IP: 0014] #### #### GsiotDiagnostics::TryGoogle [IP: 0013] #### #### GsiotDiagnostics::Main [IP: 0016] #### #### SocketException ErrorCode = 10060 #### SocketException ErrorCode = 10060 A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll #### SocketException ErrorCode = 10060 #### SocketException ErrorCode = 10060 ERROR: host name could not be resolved -> are all cables connected? -> do you have a PC on the same local network whose Web browser works? sending request #### Exception System.NullReferenceException - CLR_E_NULL_REFERENCE (1) #### #### Message: #### GsiotDiagnostics::TryGoogle [IP: 002d] #### #### GsiotDiagnostics::Main [IP: 0016] #### A first chance exception of type 'System.NullReferenceException' occurred in GsiotDiagnostics.exe An unhandled exception of type 'System.NullReferenceException' occurred in GsiotDiagnostics.exe
If you want a treat and don't mind the treatment...

#3 Nicky

Nicky

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts
  • LocationDenmark

Posted 28 October 2012 - 08:59 AM

Have to double-checked that your'e referring SecretLabs.Hardware.NetduinoPlus and not SecretLabs.Hardware.Netduino (or something close to those names) ? The reason I'm asking, is that it should throw an exception when trying to sockets, as far as I know. Lets begin, by checking that there's actually established a connection. Try something lile Debug.Print(Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].IPAddress) to verify, that the device actually gets an IP. If DHCP is enabled (I always have), then the IP should be anything except 0.0.0.0 . It's could also be neccesary to halt the execution of code, in the where first second after booting your Netduino, due to LwIP... If you get an IP, then try to ping it from the cmd (Windows-Key+R -> type cmd -> enter -> ping ip-address-here -> enter -> wait for result -> cheer/cry).

ntools
TCP Listener (Beta) · FTP Server (Alpha)
Netduino Plus Go Module · Xml Parser
http://ntools.codeplex.com/


#4 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 28 October 2012 - 09:32 AM

I tried disabling DHCP and using a static IP with no luck.

#### SocketException ErrorCode = 10060
ERROR: host name could not be resolved


Did you also enter static DNS servers?
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#5 caEstrada

caEstrada

    Advanced Member

  • Members
  • PipPipPip
  • 84 posts

Posted 28 October 2012 - 06:15 PM

Did you also enter static DNS servers?


Dan,

What version of NETMF do you have? 4.2?

From a suggestion in this forum, I do always:

//My Netduino Plus MAC on the sticker ...very important!!
byte[] MAC = { 0x5C, 0x86, 0x4A, 0x00, 0x4E, 0x5B };

//The ip address I assign to my Netduino plus
Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].EnableStaticIP("192.168.1.102", "255.255.255.0", "192.168.1.254");

Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].PhysicalAddress = MAC;

//In my case, I provide statict addressing
//Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].EnableDhcp();



and it works perfect on the network my customer has.

Let me know if I can help!!

#6 baxter

baxter

    Advanced Member

  • Members
  • PipPipPip
  • 415 posts

Posted 28 October 2012 - 06:53 PM

For problems on the the PC network side you can resolve a lot of problems by looking at the arp cache. See posts #3 and #4, http://forums.netdui...ng-ntp-service/ Also, make certain that you have the correct MAC address in Network Configuration (MFDeploy). The arp cache links Ethernet addressing (IP addressing) to hardware addressing (MAC addressing). If this association is not correct, Netduino networking will not work. Baxter

#7 Dan Kowalczyk

Dan Kowalczyk

    Advanced Member

  • Members
  • PipPipPip
  • 44 posts
  • LocationSeattle

Posted 29 October 2012 - 03:10 AM

Have to double-checked that your'e referring SecretLabs.Hardware.NetduinoPlus and not SecretLabs.Hardware.Netduino (or something close to those names) ?


My code does reference this library.

Lets begin, by checking that there's actually established a connection. Try something lile Debug.Print(Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].IPAddress) to verify, that the device actually gets an IP.


The code from Chapter 8 already includes a debug statement like this. It does show me an IP.

If you get an IP, then try to ping it from the cmd (Windows-Key+R -> type cmd -> enter -> ping ip-address-here -> enter -> wait for result -> cheer/cry).


I'm still crying :)
If you want a treat and don't mind the treatment...

#8 Dan Kowalczyk

Dan Kowalczyk

    Advanced Member

  • Members
  • PipPipPip
  • 44 posts
  • LocationSeattle

Posted 29 October 2012 - 03:22 AM

Did you also enter static DNS servers?


I didn't until I read your post, but it still didn't work. I looked up my DNS IP with ipconfig and used it (192.168.1.1) in both "Primary DNS" and "Secondary DNS" fields. From what I read in GSIOT, you could leave those entries as 0.0.0.0. Thanks for your help.

Edit: I also made sure that the Ethernet connection I'm using for the Netduino is good by plugging it to my laptop with wireless shut off. It connected no problem.
If you want a treat and don't mind the treatment...

#9 Dan Kowalczyk

Dan Kowalczyk

    Advanced Member

  • Members
  • PipPipPip
  • 44 posts
  • LocationSeattle

Posted 29 October 2012 - 03:37 AM

Dan,

What version of NETMF do you have? 4.2?


I have version 4.1 since this is what is recommended in the Download section of this site.

From a suggestion in this forum, I do always:

//My Netduino Plus MAC on the sticker ...very important!!
byte[] MAC = { 0x5C, 0x86, 0x4A, 0x00, 0x4E, 0x5B };

...


I tried all your suggestions and my browser still doesn't want to connect to the Netduino. I am running the example code from Chapter 8.

Let me know if I can help!!


I really appreciate the it! Here is a screenshot of my current network settings in MFDeploy:
Attached File  network_settings.png   23.54KB   39 downloads
If you want a treat and don't mind the treatment...

#10 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 29 October 2012 - 04:14 AM

Hi Dan, Just to confirm: when you ping the device's IP address, you don't get a response. Correct? Does the "ACT" led on the Netduino Plus blink? If not, there may be a settings mismatch. Also...are your Netduino Plus and PC are connected to the same Ethernet hub? Chris

#11 Dan Kowalczyk

Dan Kowalczyk

    Advanced Member

  • Members
  • PipPipPip
  • 44 posts
  • LocationSeattle

Posted 29 October 2012 - 04:26 AM

Just to confirm: when you ping the device's IP address, you don't get a response. Correct?

Does the "ACT" led on the Netduino Plus blink? If not, there may be a settings mismatch.

Also...are your Netduino Plus and PC are connected to the same Ethernet hub?


When I ping the IP address, I get the message "Request timed out."
The ACT led is blinking when I run the program. My Netduino is physically connected to the wireless router that my laptop is also connected to. My cable modem only has one Ethernet port that the wireless router is occupying.
If you want a treat and don't mind the treatment...

#12 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 29 October 2012 - 05:35 AM

Hi Dan,

When I ping the IP address, I get the message "Request timed out."

And if you unplug your Netduino's Ethernet connection, does the ping from your PC show the same result?

Can you copy the output of your Netduino's IP settings here, along with the output from "ipconfig" on your PC? So we can see the DHCP subnet settings?

Have you tried plugging your computer directly into the same hub as the Netduino Plus?

If all else fails, Wireshark can help diagnose what's going on...although you'd need to share a connection between your PC and the Netduino to do that.

Chris

#13 Nobby

Nobby

    Advanced Member

  • Members
  • PipPipPip
  • 70 posts

Posted 29 October 2012 - 10:57 AM

I have version 4.1 since this is what is recommended in the Download section of this site.



I tried all your suggestions and my browser still doesn't want to connect to the Netduino. I am running the example code from Chapter 8.



I really appreciate the it! Here is a screenshot of my current network settings in MFDeploy:
Attached File  network_settings.png   23.54KB   39 downloads


I noticed in your MFDeploy screenshot that your default gateway isn't in the same IP pool as the DHCP assigned IP address(192.168.5.XXX vs 192.168.1.XXX). Since you're using 24-bit networking, a lot of things are going to go south here. It also suggests that you might have some sort of configuration issue in the netduino or your router.

--Edit my bad: I saw that was your old static IP address.

#14 Dan Kowalczyk

Dan Kowalczyk

    Advanced Member

  • Members
  • PipPipPip
  • 44 posts
  • LocationSeattle

Posted 31 October 2012 - 08:52 PM

Hi Dan,

And if you unplug your Netduino's Ethernet connection, does the ping from your PC show the same result?

Can you copy the output of your Netduino's IP settings here, along with the output from "ipconfig" on your PC? So we can see the DHCP subnet settings?

Have you tried plugging your computer directly into the same hub as the Netduino Plus?


Chris,

I assume when you ask me if I've pinged Netduino, you mean that I've done so from the command line and not the MFDeploy window. In this case, I tried pinging Netduino both connected and not connected to Ethernet and I still receive the error "Request timed out.":

Pinging 192.168.5.129 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 192.168.5.129:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

I also tried plugging my laptop directly into the router and I get the same error.

Here is my ipconfig output:

Windows IP Configuration

   Host Name . . . . . . . . . . . . : Dietzgen
   Primary Dns Suffix  . . . . . . . : 
   Node Type . . . . . . . . . . . . : Broadcast
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . . . . : hsd1.wa.comcast.net.

Ethernet adapter Local Area Connection 10:

   Connection-specific DNS Suffix  . : hsd1.wa.comcast.net.
   Description . . . . . . . . . . . : Intel(R) PRO/1000 PL Network Connection #6
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::fde7:af3a:59b7:3dd2%44(Preferred) 
   IPv4 Address. . . . . . . . . . . : 192.168.1.131(Preferred) 
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Wednesday, October 31, 2012 1:32:34 PM
   Lease Expires . . . . . . . . . . : Thursday, November 01, 2012 1:32:33 PM
   Default Gateway . . . . . . . . . : 192.168.1.1
   DHCP Server . . . . . . . . . . . : 192.168.1.1
   DHCPv6 IAID . . . . . . . . . . . : 838866264
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-15-46-55-DB-00-1A-6B-D2-CD-93
   DNS Servers . . . . . . . . . . . : 192.168.1.1
                                       75.75.75.75
                                       75.75.76.76
   NetBIOS over Tcpip. . . . . . . . : Enabled

I've attached screenshots of my IP settings and output from MFDeploy.

Hope this helps you track my bug.

Thanks a lot.

Attached Files


If you want a treat and don't mind the treatment...

#15 Dan Kowalczyk

Dan Kowalczyk

    Advanced Member

  • Members
  • PipPipPip
  • 44 posts
  • LocationSeattle

Posted 31 October 2012 - 09:06 PM

The problem is fixed. I had to access my router gateway page and see what devices were connecting to it. I think the problem was that when I was tinkering with the settings (DHCP off) I input an IP that was 192.168.5.xxx. This was out of the range of assignable IPs for my router which preferred 192.168.1.xxx.

Also, when I printed out the complete IP information (that I posted in my reply to Chris), I saw that there were three DNS addresses. One was the gateway (router) address, and the others I didn't recognize. My final settings included the gateway address as primary DNS and one of the other addresses as the secondary.
Update: I am able to run the example code with 0.0.0.0 substituted for the DNS addresses in the MFDeploy network configuration.

Thanks for all the help, everyone. Encountering all these problems is speeding up the learning process. I'm still a little perplexed why it didn't work in the first place, however.
If you want a treat and don't mind the treatment...




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.