-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpeerSendThread.java
More file actions
34 lines (26 loc) · 845 Bytes
/
peerSendThread.java
File metadata and controls
34 lines (26 loc) · 845 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
public class peerSendThread implements Runnable {
peerUtilites peerU;
String[] args;
public peerSendThread(peerUtilites peerU, String[] args) {
this.peerU = peerU;
this.args = args;
}
public void run() {
String fromKeyboard = null;
String message = null;
try {
while (!(fromKeyboard = peerU.readFromKeyboard()).equalsIgnoreCase("bye") ) {
//System.out.println(Thread.currentThread().getName() + " sending");
message = peerU.getName() + " sent: " + fromKeyboard;
//System.out.println(peerU.getName() + " sending");
peerU.sendToSocket(message);
//fromSocket = peerU.readFromSocket();
//peerU.sendToTerminal(fromSocket);
if(peerU.readFromKeyboard().equals("Done"))
peerU.leaveGroup();
Chat_Room.main(args);
}
} catch (Exception E) {
}
}
}