- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSendThread.java
More file actions
Latest commit
executable file
·36 lines (32 loc) · 910 Bytes
/
Copy pathSendThread.java
File metadata and controls
executable file
·36 lines (32 loc) · 910 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
importjava.io.IOException;
importjava.util.Date;
publicclassSendThreadextendsThread {
publicSocketDemosocketDemo;
publicvoidrun(){
while (this.socketDemo.myQuitSignal == false) {
if (this.socketDemo.msgQueue.isEmpty()) {
try {
java.lang.Thread.sleep(100);
} catch (InterruptedExceptione) {
e.printStackTrace();
this.socketDemo.myQuitSignal = true;
this.socketDemo.myQuitDate = newDate();
break;
}
}
else {
messageoneMsg = this.socketDemo.msgQueue.peek();
try {
System.out.println("send message");
this.socketDemo.myWriter.write(oneMsg.GetDetail());
this.socketDemo.myWriter.flush();
this.socketDemo.msgQueue.poll();
} catch (Exceptione) {
e.printStackTrace();
this.socketDemo.myQuitSignal = true;
this.socketDemo.myQuitDate = newDate();
}
}
}
}
}