私はEclipseでAndroidプロジェクトに取り組んでおり、次の問題があります。
次のコードが例外をスローするのはなぜですか
W/System.err(5354): java.net.ConnectException: failed to connect to localhost/127.0.0.1 (port 80): connect failed: ECONNREFUSED (Connection refused)
私の変数 AUTHENTICATION_SERVER_ADDRESS は localhost ではなく、http://myserver.com/folder/のようなオンライン サーバー アドレスです。
私のサーバーに接続するコードサンプル:
url = new URL(AUTHENTICATION_SERVER_ADDRESS);
HttpURLConnection connection;
connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
PrintWriter out = new PrintWriter(connection.getOutputStream());
の行で例外がスローされPrintWriter
ます。どうすればこれを解決できますか? ありがとう!