Ниже приведен список ссылок, через которые я прошел -< /p>
[*] Как подключиться к моему веб -серверу http: // localhost от eclipse < /p> < /li>
эмулятор
Как я могу получить доступ к моему локальномухосту с моего устройства Android?protected Void doInBackground(Void... params)
{
try
{
HttpURLConnection connection = null;
URL url = new URL("http://10.0.2.2:8080/android_connect/us ... ration.php");
connection = (HttpURLConnection)url.openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestMethod("POST");
connection.setUseCaches(false);
connection.setConnectTimeout(720000000);
connection.setReadTimeout(72000000);
connection.connect();
OutputStreamWriter output = new OutputStreamWriter(connection.getOutputStream());
output.write(emp_details.toString());
output.flush();
output.close();
HttpResult = connection.getResponseCode();
connection.disconnect();
}
catch(Exception e)
{
e.printStackTrace();
}
return null;
}
< /code>
Я пытаюсь подключить Android с базой данных MySQL с помощью PHP через WAMP -сервер. PHP -файл (user_registration.php) сохраняется в приведенном ниже пути -< /p>
C:\wamp\www\android_connect
< /code>
Теперь после выполнения кода я получаю ошибку, такую как « java.net.sockettimeoutexception: не удалось подключиться к /10.0.2.2 (порт 8080) после 720000000MS: Isconnected: eTimedout (подключение по сравнению) < /press>». Решите эту проблему - < /p>
Android Connection с Localhost < /p>
Но не мог понять, как она была решена!
Можете ли вы помочь мне в этом случае? Обратите внимание, что я использую Android Studio для моей сборки. < /P>
Заранее! < /P>
Подробнее здесь: https://stackoverflow.com/questions/354 ... -timed-out
Мобильная версия