北理工 通信网络基础大作业
Server Thread
package com.wang.server;
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.OutputStream;
import java.io.OutputStreamWriter; import .Socket; import java.util.Iterator; import java.util.Map; import java.util.Set;
import com.wangcanpei.util.Util;
public class ServerThread extends Thread{ private Socket socket;
OutputStream os = null; BufferedWriter bw = null; BufferedReader br = null; InputStream is = null;
public ServerThread(Socket socket){ this.socket=socket; }
public void write(String line){ try {
bw.write(line + "\r"); bw.flush();
} catch (IOException e) {
// TODO Auto-generated catch block e.printStackTrace(); } }
public void run() {