我必须使用Socket。 我尝试连接到http://ftp.byfly.by并收到错误消息:
java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at java.net.Socket.<init>(Socket.java:434)
at java.net.Socket.<init>(Socket.java:211)
at task4.TestClientSocket.main(TestClientSocket.java:17)
public static void main(String args[]) throws IOException {
final String host = "82.209.230.71";
final int portNumber = 1028;
System.out.println("Creating socket to '" + host + "' on port " + portNumber);
Socket socket = new Socket(host, portNumber);
System.out.println("YEEEEES");
登录名和密码如何? 我做了本地服务器客户端,但是我不明白它在网络中的工作原理。