⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mytimeclient.java

📁 服务器端和客户端程序
💻 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 + -