Closeable自定义关闭类
package TalkTCPSocket;
import java.io.Closeable;
public class Utils {
public static void close(Closeable... targets) {
for (Closeable target : targets) {
try {
if (null != target) {
target.close();
}
} catch (Exception e) {
}
}
}
}
Client
客户发送端
package TalkTCPSocket;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;
/**
* 发送端
* @author pmc
*
*/
public class TChatClient4Send implements Runnable{
private BufferedReader re;
private DataOutputStream out;
private Socket client;
private boolean isRunning;
public TChatClient4Send(Socket client){
this.client=client;
this.isRunning=true;
System.out.println("Send:"+isRunning);
try {
re=new BufferedReader(new InputS