📄 multiclient1.java
字号:
package multithread;
import java.net.*;
import java.io.*;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2005</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class multiClient1 {
public multiClient1() {
}
static int SERVER_PORT=4000;
public static void main(String[] args) {
//multiClient multiclient = new multiClient();
int count=100;
for(int i=1;i<count;i++){
try {
Socket s = new Socket(InetAddress.getLocalHost(), SERVER_PORT);
String info;
InputStreamReader input;
BufferedReader reader;
input = new InputStreamReader(s.getInputStream());
reader = new BufferedReader(input);
info = reader.readLine();
System.out.println("client "+i+":"+info);
s.close();
}
catch (IOException e) {
System.out.println("Can't connect to server.");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -