-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient2.java
More file actions
41 lines (34 loc) · 856 Bytes
/
Client2.java
File metadata and controls
41 lines (34 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import java.io.*;
import java.net.*;
public class Client2{
Socket socket;
BufferedReader in;
PrintWriter out;
BufferedReader line;
public Client2(){
try{
//while(true){
socket = new Socket("127.0.0.1",10000);
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
out = new PrintWriter(socket.getOutputStream(),true);
System.out.println(in.readLine());
line = new BufferedReader(new InputStreamReader(System.in));
out.println(line.readLine());
//System.out.println(in.readLine());
line.close();
out.close();
in.close();
//}
}catch (IOException e) {
}finally{
try {
socket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static void main(String[] args) {
new Client2();
}
}