public class Server1 {
public static void main(String[] args) throws IOException {
Calendar c = Calendar.getInstance();
ServerSocket ss = new ServerSocket(30000);
// 采用循环方式不断接受来自客户端的请求
while (true) {
Socket s = ss.accept();
System.out.println("服务器秒1 " + c.get(Calendar.SECOND));
PrintStream p = new PrintStream(s.getOutputStream());
p.println("服务器祝你生日快乐!");
System.out.println("服务器秒2 " + c.get(Calendar.SECOND));
p.close();
// ss.close();
}
}
}