网络编程聊天室------客户端发送
/**
* 客户端发送请求线程
* @author Administrator
*
*/
public class ClientSendDome extends Thread{
public Socket client;
public ClientSendDome(Socket client) {
super();
this.client = client;
}
@Override
public void run() {
Scanner sc = new Scanner(System.in);
while(true){
String str = sc.nextLine().trim();
try {
OutputStream os = client.getOutputStream();
os.write(str.getBytes());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}