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

HttpWebRequest.GetResponse freezes

HttpWebRequest

  • Please log in to reply
1 reply to this topic

#1 per123

per123

    Member

  • Members
  • PipPip
  • 12 posts

Posted 20 September 2013 - 08:47 AM

Hi

 

HttpWebRequest.GetResponse newer returns if calling a nonexistent IP.

It frezes even if timeout's is lowered.

 

Per

StreamReader stream = null;

string result = string.Empty;

WebResponse webResponse = null;

try {

HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create("http://192.168.1.221/values.html");

//webReq.Timeout = 10000;

//webReq.ReadWriteTimeout = 500;

webResponse = webReq.GetResponse();// never returns

if (webResponse.ContentLength > 0) {

stream = new StreamReader(webResponse.GetResponseStream());

result = stream.ReadToEnd();

if (result != null && result.Length > 10) {

webReqFejl = false;

}

else {

webReqFejl = true;

}

//Debug.Print("Data fra pillefyr hentet");

}

else {

webReqFejl = true;

}

}

catch (Exception ex) {

webReqFejl = true;

#if DEBUG

Debug.Print(ex.Message);

#endif

}

finally {

if (stream != null) {

stream.Close();

}

if (webResponse != null) {

webResponse.Close();

}

}

return result;



#2 grey

grey

    Member

  • Members
  • PipPip
  • 12 posts

Posted 01 October 2013 - 08:10 AM

Hi per123,

 

ist the incoming Port 80 in the Firewall open on the Webserver?

 

greeting grey







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.