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