-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient1.java
More file actions
44 lines (39 loc) · 1.14 KB
/
Copy pathClient1.java
File metadata and controls
44 lines (39 loc) · 1.14 KB
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.lang.*;
import java.net.*;
import java.io.*;
class Client1
{
public static void main(String arg[])
{
System.out.println("Client application is running...");
String s1 = null, s2 = null;
Socket s = null;
BufferedReader br = null, brK = null;
PrintStream ps = null;
try
{
s = new Socket("localhost",1100);
brK = new BufferedReader(new InputStreamReader(System.in));
br = new BufferedReader(new InputStreamReader(s.getInputStream()));
ps = new PrintStream(s.getOutputStream());
while(!(s1 = brK.readLine()).equals("gn"))
{
ps.println(s1);
s2 = br.readLine();
System.out.println("Server says : "+s2);
System.out.println("Enter message for server : ");
}
}
catch(Exception obj)
{}
try
{
s.close();
br.close();
brK.close();
ps.close();
}
catch(Exception obj)
{}
}
}