Edit:
As I have seen, it also happens with simple setup:
inputstream stream = new URL ("http://xx.xx.xxx.xxx/GetAll.php") .openstream ();
Gives the same timeout error I think I'm missing some basic configuration.
I have used HTTPGet to connect to the PHP web service. I noticed that it disliked it, so I was trying to switch to the recommended HttpUrlConnection, but no success Not found
The HttpURLConnection service does not seem to be able to connect, even if I can connect to my web browser without any problems.
My connection code:
URL myUrl = new URL ("http://xx.xx.xxx.xxx/GetAll.php"); HttpURL Connection Request = (HttpURL Connection) myUrl.openConnection (); Request.setRequestProperty ("content type", "text / xml; charset = UTF-8"); InputStream stream = request.getInputStream ();
GetAll.php file:
The result I'm getting from the file:
[{"EventID": 1, "Start time": 1300, "Duration": 1 , "EventDate": "2015-05-17", "Event Order": 1, "Type": 0, "Name": "\ u05e2 \ u05d1 \ u05e8 \ u05d9 \ u05ea and English", "Organizer": "Leader Thanks,
P>Neta
I want to share my solution because it gives me time to fall hair.
As it turns out, "Time Out" is nothing to do with the code of exception, this is a network connectivity problem The phone that I used to debug is sometimes connected to WiFi, Although it is not really.
However, if you have this exception, then try to check your network connection. Good luck!
No comments:
Post a Comment