forked from YiDaoCai/RemoteDesktop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServerThread.java
More file actions
50 lines (45 loc) · 1.27 KB
/
ServerThread.java
File metadata and controls
50 lines (45 loc) · 1.27 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package DesktopServerProcess;
//线程vo
import java.io.*;
import java.net.Socket;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import CommonClass.Information;
public class ServerThread extends ServerSocketHandler {
private static Map<String, ServerThread> UserList = new HashMap<String, ServerThread>();
//private BufferedReader is;
public ServerThread(Socket c) throws IOException {
super(c);
}
public void setClient(Socket c) {
this.socket = c;
}
public Socket getSocket() {
return this.socket;
}
public static int getUserList() {
return UserList.size();
}
public static ServerThread getServerThread(String ip) {
return UserList.get(ip);
}
public static Iterator<Entry<String, ServerThread>> getUser() {
return UserList.entrySet().iterator();
}
public static void addUserList(String intelAdd, ServerThread st) {
UserList.put(intelAdd, st);
}
public static void removeUserList(String string) {
UserList.remove(string);
}
/**
* @return
* 向客户端发送消息
*/
public void sendMessage(Information info) {
writer.send(info.toString());
//将从系统标准输入读入的字符串输出到Server
}
}