久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Android - 嘗試連接到本地服務器時出錯(Xampp)

Android - error while try connect to local server(Xampp)(Android - 嘗試連接到本地服務器時出錯(Xampp))
本文介紹了Android - 嘗試連接到本地服務器時出錯(Xampp)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

這是我的 logcat,第一行是我嘗試連接的 url,它是有效的 url

here's my logcat and the first line the url i try to connect with and it's valid url

她是我的代碼導致錯誤并拒絕連接

her is my code that cause the error and make the connection to refuse

public static String makeHttpRequest(URL url) throws IOException {
    String jsonResponse = "";
    Log.e(LOG_TAG, url.toString());

    // If the URL is null, then return early.
    if (url == null) {
        return jsonResponse;
    }

    HttpURLConnection urlConnection = null;
    InputStream inputStream = null;
    try {
        urlConnection = (HttpURLConnection) url.openConnection();

        urlConnection.setReadTimeout(10000 /* milliseconds */);
        urlConnection.setConnectTimeout(15000 /* milliseconds */);
        urlConnection.setRequestMethod("GET");
        urlConnection.connect();

        // If the request was successful (response code 200),
        // then read the input stream and parse the response.
        if (urlConnection.getResponseCode() == 200) {
            inputStream = urlConnection.getInputStream();
            jsonResponse = readFromStream(inputStream);
        } else {
            Log.e(LOG_TAG, "Error response code: " + urlConnection.getResponseCode());
        }
    } catch (IOException e) {
        Log.e(LOG_TAG, "Problem retrieving the Category JSON results.", e);
    } finally {
        if (urlConnection != null) {
            urlConnection.disconnect();
        }
        if (inputStream != null) {
            inputStream.close();
        }
    }
    return jsonResponse;
}

我已經(jīng)知道如何使 Http 連接并且以前做過很多但這是第一次在本地服務器上

i already know how to make Http connect and done it a lot before but this the first time on local server

推薦答案

由于模擬器和筆記本的本地主機不同,您需要做以下操作:

Since local host for Emulator and Laptop is different, you need to do following:

  1. 使用筆記本電腦命令提示符中的 ipconfig 命令獲取 PC 的 IP 地址.
  2. 您應該在 URL 中使用 ipAddress,而不是使用 localhost.
  1. Get the IP address of your PC using: ipconfig command in your Laptop's command prompt.
  2. Instead of using localhost, you should use ipAddress in your URL.

所以您的地址將變?yōu)?http://<ip地址>/lotus/getstats.php?category=ATM

這篇關(guān)于Android - 嘗試連接到本地服務器時出錯(Xampp)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

EditText: Disable Paste/Replace menu pop-up on Text Selection Handler click event(EditText:禁用文本選擇處理程序單擊事件上的粘貼/替換菜單彈出)
Multiline EditText with Done SoftInput Action Label on 2.3(2.3 上帶有完成 SoftInput 操作標簽的多行 EditText)
How to detect the swipe left or Right in Android?(如何在 Android 中檢測向左或向右滑動?)
Prevent dialog dismissal on screen rotation in Android(防止在Android中的屏幕旋轉(zhuǎn)對話框解除)
How do I handle ImeOptions#39; done button click?(如何處理 ImeOptions 的完成按鈕點擊?)
How do you set EditText to only accept numeric values in Android?(您如何將 EditText 設(shè)置為僅接受 Android 中的數(shù)值?)
主站蜘蛛池模板: 中文字幕一区二区在线观看 | 亚洲一区二区不卡在线观看 | 91久久精品国产91久久性色tv | 日韩欧美三级在线 | 黄色网址免费在线观看 | 91精品国产91久久综合桃花 | 日本电影免费完整观看 | 欧美一级特黄aaa大片在线观看 | 天堂在线1 | 亚洲国产成人精品女人久久久野战 | 国产精品视频一区二区三区不卡 | 欧美美女二区 | 999精品在线观看 | 精品国产乱码久久久久久老虎 | 国产在线观看一区二区三区 | 无码日韩精品一区二区免费 | 欧美成人第一页 | 人人天天操 | 成人午夜在线观看 | 久久精品女人天堂av | 午夜精品久久久久久久久久久久久 | 久热精品免费 | 成人自拍视频 | 日韩成人在线观看 | 日本天天操| 91视频在线观看 | 国产精品美女一区二区 | 新疆少妇videos高潮 | 日日干天天干 | 天天操妹子 | 91在线观看视频 | 国产黄色av电影 | 成人综合视频在线观看 | 91最新入口 | 国产yw851.c免费观看网站 | 欧美日韩亚洲一区 | 黑人巨大精品欧美一区二区免费 | 亚洲男女激情 | 午夜影视大全 | 亚洲乱码一区二区三区在线观看 | 亚洲国产精品久久人人爱 |