📄 dayclient.java
字号:
import java.io.*;
import java.net.*;
/**
* Tiny socket client for the Unix 'daytime' protocol.
*/
public class Dayclient
{
public static void main(String[] args)
{
Socket csocket;
BufferedReader timestream;
if (args.length < 1) {
System.err.println("Please supply a host name or IP address");
System.exit(0);
}
try
{
csocket = new Socket(args[0],13);
timestream = new BufferedReader(new InputStreamReader(csocket.getInputStream()));
String thetime = timestream.readLine();
System.out.println("it is "+ thetime + " at " + args[0]);
csocket.close();
}
catch(IOException e)
{ System.err.println(e);}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -