forked from arjunfzk/Tensorflow_gun_detection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClient1.java
44 lines (41 loc) · 1020 Bytes
/
Client1.java
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
42
43
44
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.Socket;
public class Client1
{
public Client1(String msg) {
Socket sk;
try {
sk = new Socket("172.22.32.127",9898);
BufferedReader sin=new BufferedReader(new InputStreamReader(sk.getInputStream()));
PrintStream sout=new PrintStream(sk.getOutputStream());
BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
String s;
while ( true )
{
System.out.print("Client : ");
//s=stdin.readLine();
s = msg;
sout.println(s);
s=sin.readLine();
System.out.print("Server : "+s+"\n");
if ( s.equalsIgnoreCase("BYE") )
break;
break;
}
sk.close();
sin.close();
sout.close();
stdin.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void main(String args[]) throws Exception
{
new Client1("Not found");
}
}