求教输入输出流
class ReadWorkThread extends Thread {
public void run() {
try {
while (!exitFlag) {
String str = in.readUTF();
if (str != null) {
ui.receiveTF.setString(str);
}
}
} catch (
IOException e) {
if (!exitFlag)
ui.state.setText( "读取数据失败 ");
}
}
}
class WriteWorkThread extends Thread {
DataOutputStream out = null;
public WriteWorkThread(DataOutputStream out){
this.out = out;
}
public void run() {
try {
while (!exitFlag) {
synchronized (this) {
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();