回复 3楼 疯狂的小a
import
import
import
import
import
import
import
import
public class URLReader {
public static void main(String[] args) throws IOException {
InetAddress address = InetAddress.getByName("localhost");
Socket s = new Socket(address, 8080);
//向服务器侦听端口发出请求
System.out.println("客户端已启动。");
}
}
编译后提示
Exception in thread "main" Connection refused: connect
at (Native Method)
at (Unknown Source)
at (Unknown Source)
at (Unknown Source)
at (Unknown Source)
at (Unknown Source)
at (Unknown Source)
at (Unknown Source)
at (Unknown Source)
at (Unknown Source)
at (Unknown Source)
at URLReader.main(URLReader.java:15)