-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyNetClient03.java
More file actions
38 lines (30 loc) · 895 Bytes
/
MyNetClient03.java
File metadata and controls
38 lines (30 loc) · 895 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
package network;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;
public class MyNetClient03 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Socket socket = null;
BufferedReader in = null;
PrintWriter out = null;
try {
socket = new Socket("10.10.0.125", 12345);
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
out= new PrintWriter(socket.getOutputStream(),true);
String data1 = in.readLine();
String data2 = in .readLine();
out.println("7");
// out.flush();
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}