📄 mytimeclient.java
字号:
import java.net.*;
import java.io.*;
public class MyTimeClient
{
public static void main(String[] args)
{
try{
Socket s= new Socket ("127.0.0.1",1001);
PrintStream out = new PrintStream(s.getOutputStream());
BufferedReader in = new BufferedReader(new InputStreamReader
(s.getInputStream()));
String x = in.readLine();
if(!x.equals("PASSWORD")){
System.out.println("Server is not time server");
System.exit(0);
} else {
out.println("chain");
}
x=in.readLine();
if(x.equals("WRONG")){
System.out.println("worong password");
} else {
System.out.println(x);
}
out.close();
s.close();
in.close();
}catch(IOException e){}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -