-
Notifications
You must be signed in to change notification settings - Fork 0
/
talkClient.java
34 lines (32 loc) · 950 Bytes
/
talkClient.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
import java.io.*;
import java.net.*;
public class talkClient{
public static void main(String[] args){
//InputStream in = null;
//OutputStream out = null;
try{
Socket s = new Socket("127.0.0.1", 6665);
//in = s.getInputStream();
// out = s.getOutputStream();
BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
BufferedReader ind = new BufferedReader(new InputStreamReader(s.getInputStream()));
PrintWriter outd = new PrintWriter(s.getOutputStream());
String ddb = null;
//outd.println(new String("haha"));
ddb = keyboard.readLine();
while(!ddb.equals("bye")){
outd.println(ddb);
outd.flush();
System.out.println("Me:"+ddb);
System.out.println("dadoub");
//System.out.println("Server:"+ind.readLine());
ddb = keyboard.readLine();
}
outd.close();
ind.close();
s.close();
}catch(IOException e){
e.printStackTrace();
}
}
}