-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient.java
More file actions
29 lines (24 loc) · 747 Bytes
/
Client.java
File metadata and controls
29 lines (24 loc) · 747 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
//Atul_Lakhera1018462
import java.io.*;
import java.net.*;
public class Client
{
public static void main(String args[])throws Exception
{
Socket s=new Socket("localhost",8081);
DataInputStream dataRead=new DataInputStream(s.getInputStream());
DataOutputStream dataWrite=new DataOutputStream(s.getOutputStream());
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String str="",str2=""; //Atul_Lakhera1018462
while(!str.equals("bye"))
{
str=br.readLine();
dataWrite.writeUTF(str);
dataWrite.flush();
str2=dataRead.readUTF();
System.out.println("server : "+str2);
}
dataRead.close();
s.close();
}
}