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

Socket errors 10056 and 10060


  • Please log in to reply
5 replies to this topic

#1 TomYee

TomYee

    New Member

  • Members
  • Pip
  • 9 posts

Posted 08 May 2011 - 12:40 PM

I am having some difficulties with the HelloPachubeSockets example 9-1 from Getting Started with the Internet of Things.

When running on the Netduino Plus through the USB connection, I very frequently (90% of the time) get either socket error 10060 (Connection timed out) or 10056 (Socket is already connected). However, when running on the Emulator, this never happens.

To make sure that this is really a hardware versus emulation problem rather than a programming issue, I modified example 9-1 so that I could switch easily between using AnalogInput in hardware, versus using a random number generator when using the Emulator by means of a #define at the start of the program.

I have attached my solution.

Attached Files



#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 08 May 2011 - 09:36 PM

Hi TomYee, What version of firmware are you running on your Netduino Plus? If you haven't updated to v4.1.0.6 or v4.1.1 beta yet, I'd highly recommend doing so. Also, the Netduino Plus uses the lwIP open source networking stack (instead of the Windows-based networking stack). So the packets may be slightly different. But things should still work properly. Chris

#3 TomYee

TomYee

    New Member

  • Members
  • Pip
  • 9 posts

Posted 09 May 2011 - 07:07 PM

Hi TomYee,

What version of firmware are you running on your Netduino Plus? If you haven't updated to v4.1.0.6 or v4.1.1 beta yet, I'd highly recommend doing so.

Also, the Netduino Plus uses the lwIP open source networking stack (instead of the Windows-based networking stack). So the packets may be slightly different. But things should still work properly.

Chris


I failed to locate v4.1.1 beta using the forum search tool, but Google located it easily at
http://forums.netdui...re-v411-beta-1/

MFDeploy 4.1 kept "freezing" on me, whether it was simply to detect "Device Capabilities", or to deploy the new image files after erasing. I finally resorted to downloading an obsolescent version of MFDeploy 2.0.0.0, and succeeded in my deployment using this old version. Even then, it required multiple tries before I succeeded. An interesting side benefit that I don't understand is that MFDeploy 4.1 now works fine.


The old solution version was 4.1.0.6 with a build date of Feb 14 2011.
The new solution version is 4.1.1.0 with a build date of Mar 26 2011.


Unfortunately, the net result after all of this work is that I continue to have socket connection issues. :unsure:

One possibility that I am looking at is to correct some coding deficiencies that I see in the textbook example. The main issue that I see is that the code in example 9-1 does not guarantee closing the socket if one interrupts the running of the program. The best way to guarantee closing the socket is with the "using" construct.

Quite possibly the lwIP open source networking stack is less tolerant of improperly closed sockets than the Windows networking stack. For example, perhaps it handles "linger" differently.

I will let you know if recoding with "using" improves anything.

Thanks for all your help!

Tom

#4 TomYee

TomYee

    New Member

  • Members
  • Pip
  • 9 posts

Posted 09 May 2011 - 11:06 PM

I will let you know if recoding with "using" improves anything.


This has been a very frustrating afternoon. At first I thought that recoding example 9-1 with "using" improved the situation, because I managed to run the application five times in a row without hanging or throwing an exception. But then it crashed on the sixth try with a 10053 error code.

Then I checked by reverting the code to the way it was in the textbook example... and the original code now worked just as well as my reworked code. :huh:

In other words, I have absolutely no evidence for any improvement by coding with the "using" construct.

I did, however, find that the fastest way to restore connectivity is to unplug the Netduino Plus for ten minutes, which where I work is long enough for various timeouts (such as the ARP Cache timeout) to kick in and clean up the network.

Tom

#5 rmartinez

rmartinez

    New Member

  • Members
  • Pip
  • 5 posts
  • LocationOrlando, FL

Posted 09 July 2011 - 01:44 AM

Yesterday, acquired the Netduino Plus and began trying accessing the internet. To no avail.

I'm having more or less the same problem but, instead of Socket error 10056, I'm continuously getting Socket error 10060. Please, see below. After many unlucky attempts with HelloPachube from the book, I ran the author's diagnostic program. Either way, no luck! Posted Image (Note: I'm a newbie with Netduinos).

Thanks for your comments.

=== Begin Run >>>

Diagnostics started
Version 30-Jun-2011
DHCP enabled: True
MAC address: 5C-86-4A-00-0E-29
Device address: 192.168.5.100
Gateway address: 192.168.5.1
Primary DNS address: 208.67.222.222
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: 0014] ####
#### 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?
-> Microsoft.SPOT.Net.SocketNative::getaddrinfo
System.Net.Dns::GetHostEntry
GsiotDiagnostics::Connect
GsiotDiagnostics::TryGoogle
GsiotDiagnostics::Main
sending request
#### Exception System.NullReferenceException - CLR_E_NULL_REFERENCE (1) ####
#### Message:
#### GsiotDiagnostics::TryGoogle [IP: 002e] ####
#### GsiotDiagnostics::Main [IP: 0016] ####
A first chance exception of type 'System.NullReferenceException' occurred in GsiotDiagnostics.exe
#### Exception System.NullReferenceException - CLR_E_NULL_REFERENCE (1) ####
#### Message:
#### GsiotDiagnostics::TryGoogle [IP: 008e] ####
#### 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
Uncaught exception
The thread '<No Name>' (0x1) has exited with code 0 (0x0).
Done.
Waiting for debug commands...
The program '[3] Micro Framework application: Managed' has exited with code 0 (0x0).

#6 rmartinez

rmartinez

    New Member

  • Members
  • Pip
  • 5 posts
  • LocationOrlando, FL

Posted 09 July 2011 - 02:12 AM

Yesterday, acquired the Netduino Plus and began trying accessing the internet. To no avail.

I'm having more or less the same problem but, instead of Socket error 10056, I'm continuously getting Socket error 10060. Please, see below. After many unlucky attempts with HelloPachube from the book, I ran the author's diagnostic program. Either way, no luck! Posted Image (Note: I'm a newbie with Netduinos).

Thanks for your comments.

=== Begin Run >>>

Diagnostics started
Version 30-Jun-2011
DHCP enabled: True
MAC address: 5C-86-4A-00-0E-29
Device address: 192.168.5.100
Gateway address: 192.168.5.1
Primary DNS address: 208.67.222.222
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: 0014] ####
#### 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?
-> Microsoft.SPOT.Net.SocketNative::getaddrinfo
System.Net.Dns::GetHostEntry
GsiotDiagnostics::Connect
GsiotDiagnostics::TryGoogle
GsiotDiagnostics::Main
sending request
#### Exception System.NullReferenceException - CLR_E_NULL_REFERENCE (1) ####
#### Message:
#### GsiotDiagnostics::TryGoogle [IP: 002e] ####
#### GsiotDiagnostics::Main [IP: 0016] ####
A first chance exception of type 'System.NullReferenceException' occurred in GsiotDiagnostics.exe
#### Exception System.NullReferenceException - CLR_E_NULL_REFERENCE (1) ####
#### Message:
#### GsiotDiagnostics::TryGoogle [IP: 008e] ####
#### 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
Uncaught exception
The thread '<No Name>' (0x1) has exited with code 0 (0x0).
Done.
Waiting for debug commands...
The program '[3] Micro Framework application: Managed' has exited with code 0 (0x0).


Found Solution: Changed to static IP address!Posted Image Please, refer to this comment to read more about




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.