forked from dkgee/SimpleChatSystem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChatClient.java
More file actions
36 lines (32 loc) · 745 Bytes
/
ChatClient.java
File metadata and controls
36 lines (32 loc) · 745 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
30
31
32
33
34
35
36
package com.tk.chat;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* 功能:聊天客户端
* 描述:
* @author jinhuatao
* @date 2015-3-5 上午11:10:21
*/
public class ChatClient {
public static void main(String[] args) {
try {
ClientThread client = new ClientThread(args[0]);
client.start();
//输入输出流
BufferedReader sin = new BufferedReader(
new InputStreamReader(System.in));
//循环读取键盘输入
String readline;
while((readline = sin.readLine()) != null){
if(readline.equals("bye")){
client.close();
System.exit(0);
}
client.send(readline);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}