Reply
15 Feb 2012
By liortal
Member
Playstation Staff

Network connectivity issues from the emulator

[ Edited ]
14 Replies 532 Views edited 15-02-2012

Has anyone tried to send/receive data over the network from the emulator ?

 

I am running some code that tries to POST some data over HTTP but seems to fail with a TimeoutException.

 

It doesn't seem that the data is even sent, it just times out immediately.

 

Some interesting facts:

 

  1. The EXACT same code compiles & runs successfully on Visual Studio 2010.
  2. The EXACT same code compiles & runs successfully on MonoDevelop (not PS VITA) project.

What can be the issue ?

 

Here's a code sample of what I'm running:

 

// What we are sending
			string post_data = "api_key=*********&game_id=******&response=XML&username=Me&score=11120";
			string uri = "https://www.scoreoid.com/api/createScore";

			// Create a request
			var request = (HttpWebRequest)WebRequest.Create (uri);

			request.Method = "POST";

			request.KeepAlive = false;
			request.ProtocolVersion = HttpVersion.Version10;

			// Turn our request string into a byte stream
			byte[] postBytes = Encoding.ASCII.GetBytes (post_data);

			// This is important - make sure you specify type this way
			request.ContentType = "application/x-www-form-urlencoded";
			request.ContentLength = postBytes.Length;

			var requestStream = request.GetRequestStream ();

			// Now send it
			requestStream.Write (postBytes, 0, postBytes.Length);
			requestStream.Close ();

			var stream = request.GetResponse ().GetResponseStream ();

			using (var sr = new StreamReader(stream))
			{
				var res = sr.ReadToEnd ();
				Console.WriteLine (res);
			}

 

Please use plain text.
Reply
0 Kudos
Message 1 of 15 (532 Views)
Reply
0 Kudos
Level 6
 
Playstation Staff

Re: Network connectivity issues from the emulator

[ Edited ]

Hi liortal,

Thank you very much for raising this with us. From my own tests just now running your code (all be it with a different URL for debugging), and a slightly different implementation, I can confirm that I was not able to reach the destination URL because of a timeout. I was however able to reach it with the same code running on an Xperia Play. I can confirm this works with both GET and POST requests.

We will continue to investigate why this is the case and will update you when we have some more information.

Best regards,
James

PlayStation®Mobile Dev Team
Please use plain text.
Reply
0 Kudos
Message 2 of 15 (515 Views)
Reply
0 Kudos
Level 2
 
Playstation Staff

Re: Network connectivity issues from the emulator

Thanks a lot!

Another weird thing that i saw was different behaviour when running my game in debug/non debug mode.

Using CTRL-F5 (launch without debugger) it works, but when debugging it fails with a timeout. You can try that yourself to see if there's any different behaviour.

Lior
Please use plain text.
Reply
0 Kudos
Message 3 of 15 (501 Views)
Reply
0 Kudos
Level 6
 
Playstation Staff

Re: Network connectivity issues from the emulator

Does the computer that you are running PlayStation Suite on use a proxy server to access the internet?

Cheers,
James
PlayStation®Mobile Dev Team
Please use plain text.
Reply
0 Kudos
Message 4 of 15 (499 Views)
Reply
0 Kudos
Level 6
 
Playstation Staff

Re: Network connectivity issues from the emulator

FYI, if you are sat behind a proxy server, you can tell HTTPWebRequest to acknowledge it like follows.

// Provide it with a Proxy and a Port to use. 
request.Proxy = new WebProxy("12.34.56.78", 8080);

 I have been able to replicate the problems using the debugger and we're looking into the causes of this. We'll let you know when we have more information.

PlayStation®Mobile Dev Team
Please use plain text.
Reply
0 Kudos
Message 5 of 15 (497 Views)
Reply
0 Kudos
Level 2
 
Playstation Staff

Re: Network connectivity issues from the emulator

I have tried both with a proxy and without a proxy.

The proxy used was simply my own dev machine (localhost) with Fiddler running on it. I used it to analyze the communication that was being sent (or not sent).

In the case i am describing, i am getting a Timeout but Fiddler shows no outgoing packets, meaning this method call throws an exception before sending out any data.
Please use plain text.
Reply
0 Kudos
Message 6 of 15 (493 Views)
Reply
0 Kudos
Level 6
 
Playstation Staff

Re: Network connectivity issues from the emulator

[ Edited ]

Likewise, I was not able to see any outgoing connections when using the debugger. I have escalated this problem to my colleagues and we'll update you if we have any progress on this.

Best regards,
James.

PlayStation®Mobile Dev Team
Please use plain text.
Reply
0 Kudos
Message 7 of 15 (470 Views)
Reply
0 Kudos
Level 2
 
Playstation Staff

Re: Network connectivity issues from the emulator

Hi,

Is there any update on this issue?
Please use plain text.
Reply
0 Kudos
Message 8 of 15 (438 Views)
Reply
0 Kudos
Level 6
 
Playstation Staff

Re: Network connectivity issues from the emulator

Hi liortal,

Apologies for the delay. I am just confirming whether this will be fixed or not in the next version.

Thanks
James
PlayStation®Mobile Dev Team
Please use plain text.
Reply
0 Kudos
Message 9 of 15 (426 Views)
Reply
0 Kudos
Level 2
 
Playstation Staff

Re: Network connectivity issues from the emulator

Is it confirmed to be fixed then?
Please use plain text.
Reply
0 Kudos
Message 10 of 15 (408 Views)
Reply
0 Kudos