私はJavaネットワークプログラミングを始めていますが、次のコードに対して常にConnect Reset例外が発生します:
import java.io.*;
import java.net.*;
import java.util.*;
public class Net {
public static void main()
{
try
{
// this not working ... URL url = new URL("http://localhost/test.php");
// not even the following trial
URL url = new URL("http://www.google.com.gh/");
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
// Exception is thrown here
InputStream in = conn.getInputStream();
}
catch (Exception ex)
{
System.out.println(ex.getMessage());
}
}
}
学習プロセスで試したすべての例は失敗しました。何が悪いのかわかりません。助けてください。