我有一个简单的服务器...
public static void main(String[] args) throws Exception{
ServerSocket server = new ServerSocket(2000);
Socket sock = server.accept();
InputStream in = sock.getInputStream();
OutputStream out = sock.getOutputStream();
PrintWriter w = new PrintWriter(out);
Scanner s = new Scanner(in);
...
和一个简单的客户......
public static void main(String[] args) throws Exception{
Socket sock = new Socket("localhost",2000);;
InputStream in= sock.getInputStream();
OutputStream out = sock.getOutputStream();
PrintWriter w = new PrintWriter(out);
Scanner s = new Scanner(in);
....
-如何将更多客户端连接到此服务器?(我还需要 2 个)-我还想将系统时间从服务器发送到客户端,然后客户端将每次发送 10 次时间加上一些固定延迟(0.5-1 秒),然后服务器必须从所有延迟中找到平均值,然后把它作为新的时间发回给客户......
感谢您的时间...