Reply
06 May 2012
Member
Playstation Staff
Accepted Solution

WebRequest getResponse() problem

7 Replies 726 Views Created 06-05-2012

So i'm using this :

HttpWebRequest wr = (HttpWebRequest)HttpWebRequest.Create("http://maps.weather.com/web/radar/us_orl_ultraradar_large_usen.jpg");
HttpWebResponse ws = (HttpWebResponse)wr.GetResponse();

  And at the getResponse() I always get:

{System.Net.WebException: The request timed out   at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0    

 

Any idea what I'm doing wrong?

Please use plain text.
Reply
0 Kudos
Message 1 of 8 (726 Views)
Reply
0 Kudos
Level 2
 
Playstation Staff

Re: WebRequest getResponse() problem

I was getting similar problems (and still do sometimes). A couple of things I have noticed;

 

1. Adding the code below initially fixed the problem for me. I'm pretty sure the Timeout parameter doesn't do anything, I just added it as habit, but setting UserAgent means that the WebServer believes you are a real web-browser - as many sites seem to block GET requests from clients that don't have a UserAgent set.

 

webRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)";
webRequest.Timeout = 30000;

 

2. I also found that if I have been testing for sometime, then some servers seem to block you.

 

3. What's really weird - my latest problem (which I've not resolved yet), is that whenever I initialise a WebRequest as soon as my app loads, then I get this error. However, if I force this action to take place sometime after my app has finished loading (just a second later) through a UI button - then it always seems to work. 

 

Hope something above helps!

Please use plain text.
Reply
0 Kudos
Message 2 of 8 (716 Views)
Reply
0 Kudos
Level 2
 
Playstation Staff

Re: WebRequest getResponse() problem

Nr 3 fixt my problem. Thanks!

Please use plain text.
Reply
0 Kudos
Message 3 of 8 (700 Views)
Reply
0 Kudos
Level 3
 
Playstation Staff

Re: WebRequest getResponse() problem

Yeah, there are some really weird problems with http in the sdk at the moment. I've gotten some serious headaches from them these last few days, where on another day I barely had any issues at all.
Please use plain text.
Reply
0 Kudos
Message 4 of 8 (655 Views)
Reply
0 Kudos
Level 3
 
Playstation Staff

Re: WebRequest getResponse() problem

[ Edited ]

I also get this message right after the timeout:

 

"D:\Program Files (x86)\SCE\Pss\mono\etc\mono\2.1\machine.config" is too deep subdirectory depth

 

"D:\Program Files (x86)\SCE\Pss\mono\etc\mono\2.1\machine.config" is too deep subdirectory depth
The request timed out: at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0

 

 

Please use plain text.
Reply
0 Kudos
Message 5 of 8 (651 Views)
Reply
0 Kudos
Level 2
 
Playstation Staff

Re: WebRequest getResponse() problem

:smileysad: same here i always have issue with networking

Please use plain text.
Reply
0 Kudos
Message 6 of 8 (641 Views)
Reply
0 Kudos
Level 6
 
Playstation Staff

Re: WebRequest getResponse() problem

niwrA, Please can you post us some code of what you are trying to do?

Thanks,
James
PlayStation®Mobile Dev Team
Please use plain text.
Reply
0 Kudos
Message 7 of 8 (610 Views)
Reply
0 Kudos
Level 3
 
Playstation Staff

Re: WebRequest getResponse() problem

[ Edited ]
Hi James, Sorry I missed this post the first time around. I was trying to read an xml file from the web, using pretty much the same code as I posted as an xmldoc.load. workaround earlier in another thread. I am away from home but I'll try to dig up the link to that at least. Edit: here http://community.eu.playstation.com/t5/General/System-Xml-XmlDocument-load/td-p/15820825 I am using the code from my last post ...
Please use plain text.
Reply
0 Kudos
Message 8 of 8 (579 Views)
Reply
0 Kudos