📄 getdaytime.java
字号:
import java.io.*;
import java.net.*;
public class GetDayTime
{ public static void main(String args[])
{ String host = args[0];
try
{ Socket connection = new Socket(host, 13);
System.out.println("Connection established:");
BufferedReader in = new BufferedReader(
new InputStreamReader(
connection.getInputStream()));
String daytime = in.readLine();
System.out.println("DayTime received: " + daytime);
connection.close();
}
catch(UnknownHostException uhe)
{ System.err.println("Host not found: " + uhe); }
catch(IOException ioe)
{ System.err.println("Error: " + ioe); }
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -