-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTCPClient1.java
More file actions
20 lines (16 loc) · 636 Bytes
/
TCPClient1.java
File metadata and controls
20 lines (16 loc) · 636 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package network;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.Socket;
public class TCPClient1 {
public static void main(String[] args) throws Exception {
for (int j = 0; j < 10000; j++) {
Socket socket = new Socket("localhost", 9100);
System.out.println("client=> " + j + " 서버와 연결됨.");
BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String data = input.readLine();
System.out.println("받은 데이터: " + data);
System.out.println("클라이언트 포트>> " + socket.getLocalPort());
}
}
}