📄 webconect.java
字号:
import java.net.*;
import java.io.*;
public class WebConect
{
/**
* Method main
*
*
* @param args
*
*/
public static void main(String[] args) {
// TODO: Add your code here
try{
Socket connection=new Socket("http://www.163.com/",80);
System.out.println("Connect established:");
System.out.println("Local host information:");
System.out.println("\t adress:"+connection.getLocalAddress());
System.out.println("\t port:"+connection.getLocalPort());
System.out.println("the remote Connection information:");
System.out.println("\t adress:"+connection.getInetAddress());
System.out.println("\t port:"+connection.getPort());
connection.close();
}
catch(UnknownHostException e){
System.err.println("Unknown host:"+args[0]);
}
catch(IOException e){
System.err.println("IOException:"+e);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -