-
Notifications
You must be signed in to change notification settings - Fork 203
Expand file tree
/
Copy pathq2client.java
More file actions
26 lines (22 loc) · 761 Bytes
/
q2client.java
File metadata and controls
26 lines (22 loc) · 761 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
package manishaJavaPractical;
import java.net.*;
import java.io.*;
public class ClientManisha{
public void main(String args[]) throws Exception
{
Socket s=new Socket("localhost",8080);
DataInputStream dataRead=new DataInputStream(s.getInputStream());
DataOutputStream dataWrite=new DataOutputStream(s.getOutputStream());
BufferedReader br=new BufferedReader (new InputStreamReader(System.in));
String str="",str2="";
while(!str.equals("hello,its Manisha")){
str=br.readLine();//reading something from the keyboard which is converted to string
dataWrite.writeUTF(str);
dataWrite.flush();
str2=dataRead.readUTF();
System.out.println("Server says: "+str2);
}
dataRead.close();
s.close();
} }
}