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

Web Request Error


  • Please log in to reply
12 replies to this topic

#1 DracoRSA

DracoRSA

    New Member

  • Members
  • Pip
  • 9 posts

Posted 23 March 2011 - 08:08 AM

Hi, I am having problems communicating with a web server. I am sending data to a URL and embedding data into the URL which will then be processed on the server appropiately. I am however battling to coomunicate with the server and a exception is thrown every time. I am communicating straight via Ethernet on a Netduino Plus. I have setup a static IP address for the device. Below is some details on the exception being throw as well as a code snippet on where I make the call. Any help will be highly appreciated :) Debug extract: Sending reading to the server ... Device Network Address: 192.168.0.108 Server URI: "http://DEVSERVER/WMW...robeReading=33" #### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (1) #### #### Message: #### Microsoft.SPOT.Net.SocketNative::getaddrinfo [IP: 0000] #### #### System.Net.Dns::GetHostEntry [IP: 0008] #### #### System.Net.HttpWebRequest::EstablishConnection [IP: 00e1] #### #### System.Net.HttpWebRequest::SubmitRequest [IP: 0013] #### #### System.Net.HttpWebRequest::GetResponse [IP: 000c] #### #### CSIR.WaterMonitoring.Netduino.WMServerComms::SendReading [IP: 00d9] #### #### CSIR.WaterMonitoring.Netduino.WMProbeData::UpdateReading [IP: 0035] #### #### CSIR.WaterMonitoring.Netduino.WMStart::Main [IP: 0120] #### #### 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 #### Exception System.Net.WebException - 0x00000000 (1) #### #### Message: host not available #### System.Net.HttpWebRequest::EstablishConnection [IP: 00f1] #### #### System.Net.HttpWebRequest::SubmitRequest [IP: 0013] #### #### System.Net.HttpWebRequest::GetResponse [IP: 000c] #### #### CSIR.WaterMonitoring.Netduino.WMServerComms::SendReading [IP: 00d9] #### #### CSIR.WaterMonitoring.Netduino.WMProbeData::UpdateReading [IP: 0035] #### #### CSIR.WaterMonitoring.Netduino.WMStart::Main [IP: 0120] #### A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll #### Exception System.Net.WebException - 0x00000000 (1) #### #### Message: #### System.Net.HttpWebRequest::GetResponse [IP: 00d3] #### #### CSIR.WaterMonitoring.Netduino.WMServerComms::SendReading [IP: 00d9] #### #### CSIR.WaterMonitoring.Netduino.WMProbeData::UpdateReading [IP: 0035] #### #### CSIR.WaterMonitoring.Netduino.WMStart::Main [IP: 0120] #### A first chance exception of type 'System.Net.WebException' occurred in System.Http.dll The code: // Send the request to the server webRequest = (HttpWebRequest)WebRequest.Create(webServerUri); webRequest.Method = "GET"; webResponse = (HttpWebResponse)webRequest.GetResponse();

#2 Fred

Fred

    Advanced Member

  • Members
  • PipPipPip
  • 302 posts
  • LocationUK

Posted 23 March 2011 - 09:48 AM

I see DNS mentioned in the errors above. Have you tried using the IP address of DEVSERVER to rule out DNS issues? DNS should work from the Netduino if configured correctly (using MFDeploy I think) but that should rule it out.

#3 DracoRSA

DracoRSA

    New Member

  • Members
  • Pip
  • 9 posts

Posted 23 March 2011 - 10:01 AM

I see DNS mentioned in the errors above. Have you tried using the IP address of DEVSERVER to rule out DNS issues? DNS should work from the Netduino if configured correctly (using MFDeploy I think) but that should rule it out.


I have used both the DNS resolved name as well as the IP Address with the same result.

#4 DracoRSA

DracoRSA

    New Member

  • Members
  • Pip
  • 9 posts

Posted 24 March 2011 - 08:59 AM

An update on this issue: I have managed to connect to the server, but the connectivity is very intermittant and very unreliable ... I manage to connect once and then the connections will fail quite a few times with the error below. It will work once more and then fail again ... I also had to change the way the QueryString is sent. The moment I add a second parameter with an ampersand (&) it fails every time ... I now add one parameter and then split the parameter into the different actual parameters I wanted to send. Here is the error being generated: Connecting to server ... Sending reading to the server ... Device Network Address: 192.168.0.108 Server URI: "http://192.168.0.133...robeReading=20" #### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (1) #### #### Message: #### Microsoft.SPOT.Net.SocketNative::recv [IP: 0000] #### #### System.Net.Sockets.Socket::Receive [IP: 0018] #### #### System.Net.Sockets.NetworkStream::Read [IP: 0062] #### #### System.Net.InputNetworkStreamWrapper::RefillInternalBuffer [IP: 0038] #### #### System.Net.InputNetworkStreamWrapper::Read_HTTP_Line [IP: 004b] #### #### System.Net.HttpWebRequest::ParseHTTPResponse [IP: 002e] #### #### System.Net.HttpWebRequest::GetResponse [IP: 0035] #### #### CSIR.WaterMonitoring.Netduino.WMServerComms::SendReading [IP: 00d9] #### #### CSIR.WaterMonitoring.Netduino.WMProbeData::UpdateReading [IP: 0035] #### #### CSIR.WaterMonitoring.Netduino.WMStart::Main [IP: 0120] #### #### SocketException ErrorCode = -1728053248 #### Exception System.Net.WebException - 0x00000000 (1) #### #### Message: #### System.Net.HttpWebRequest::GetResponse [IP: 00c8] #### #### CSIR.WaterMonitoring.Netduino.WMServerComms::SendReading [IP: 00d9] #### #### CSIR.WaterMonitoring.Netduino.WMProbeData::UpdateReading [IP: 0035] #### #### CSIR.WaterMonitoring.Netduino.WMStart::Main [IP: 0120] #### [WMServerComms.SendReading] System.Net.WebException

#5 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 24 March 2011 - 03:12 PM

Hi DracoRSA, A few quick questions: 1. Are you running the latest firmware (v4.1.0.6 or v4.1.1 alpha 7) on your Netduino Plus? 2. If you run the same code on your PC (using .NET) do you get the same sort of failures? I'm trying to isolate the issue and see if it's .NET MF related or web server related. If you have a small repro case that you could post which fails consistently, we'd be happy to load it up in the lab and help diagnose the issue. Unfortunately with web technologies the issue could lie in a lot of places...server, client, router, etc. etc. Chris

#6 DracoRSA

DracoRSA

    New Member

  • Members
  • Pip
  • 9 posts

Posted 24 March 2011 - 07:09 PM

Chris, Thanks for the response :) 1. I have used both Versions 4.1.0.6 and Version 4.1.1 Alpha 7 with the same results 2. I can take the same URL and paste it into a browser and it will work every time I post it to the hosted web page without any errors. The problem seems to be intermittant and totally random. The fact is though that it will fail 95% of the time. It will work once and then not for quite a few times, then it will work for another 4 times and then start to fail again.

#7 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 24 March 2011 - 07:12 PM

Hi DracoRSA, Thank you for the additional info. This helps us get closer to a resolution. Could you please post a short sample app so we can reproduce here? Looking at the exception dump, we can start thinking of ideas...but we're really shooting in the dark until we have sample code to reproduce the issue. Once we have that, hopefully it's a very quick resolution and we can get you off and running. Thanks for helping make Netduino a great platform, Chris

#8 DracoRSA

DracoRSA

    New Member

  • Members
  • Pip
  • 9 posts

Posted 30 March 2011 - 09:02 AM

Chris, Attached is a small test application I created that will simulate the problem. The URL it is connecting to is my test environment and you can test again against it as well. Thank you for your help :) Johan

Attached Files



#9 ColinR

ColinR

    Advanced Member

  • Members
  • PipPipPip
  • 142 posts
  • LocationCape Town, South Africa

Posted 19 August 2011 - 09:05 PM

When I first started dev using the Netduino, I cam across this post and using the advice I changed from multiple GET variables, to one concatenated value. I've since moved all data to POST. Today my netduino was more down than up, hitting the Exception System.Net.Sockets.SocketException: Microsoft.SPOT.Net.SocketNative::getaddrinfo error every 3rd or 4th attempt. Johan, have you seen the issue since?

#10 Msbh

Msbh

    New Member

  • Members
  • Pip
  • 8 posts

Posted 05 December 2011 - 05:45 AM

I am havig same problem :( can any body help me out.... #### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (1) #### #### Message: #### Microsoft.SPOT.Net.SocketNative::getaddrinfo [IP: 0000] #### #### System.Net.Dns::GetHostEntry [IP: 0008] #### #### Gsiot.Yaler.YalerListener::Accept [IP: 0038] #### #### Gsiot.Server.HttpServer::Run [IP: 0027] #### #### LedControllerHtml::Main [IP: 0070] #### #### 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 An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll

#11 ColinR

ColinR

    Advanced Member

  • Members
  • PipPipPip
  • 142 posts
  • LocationCape Town, South Africa

Posted 05 December 2011 - 07:01 AM

I am havig same problem :( can any body help me out....


Are you using GET, or POST, and are you sending multiple values?
Are you able to connect and retrieve a normal webpage without parameters?

#12 Msbh

Msbh

    New Member

  • Members
  • Pip
  • 8 posts

Posted 19 December 2011 - 09:38 PM

Are you using GET, or POST, and are you sending multiple values?
Are you able to connect and retrieve a normal webpage without parameters?




I am using post method i think so.
and yes i can retrieve a normal page without parameters .

#13 ColinR

ColinR

    Advanced Member

  • Members
  • PipPipPip
  • 142 posts
  • LocationCape Town, South Africa

Posted 20 December 2011 - 06:09 AM

You can also try declaring a single IPEndPoint variable - do the DNS lookup once, and just use the variable from then on.




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.