counter=c;}
publicvoidrun()
{
try
{
DataInputStreamin=newDataInputStream(incoming.getInputStream());
DataOutputStreamout=newDataOutputStream(incoming.getOutputStream());
System.out.println("hello");
booleandone=false;
while(!done)
{Stringaa="";
Stringstr=in.readUTF();//从客户端得到字符串
//在此加入各自的服务程序
System.out.println(str);
theT2.pass(str);//解码
theT2.tongji();//修改监控库中的信息
aa=theT2.guan();//操纵数据库
System.out.println("stringzis:"+aa);
if(aa.compareTo("null")!=0)
//若是查询数据库,返回查询后的结果
{//若不是查询数据库,不向客户端输出信息
out.writeUTF(aa);
out.flush();}
}//while
incoming.close();//线程关闭
}//try
catch(IOExceptione)
{System.out.println(e);}
}//endrun
}
//----------------------------------------
classS
{
publicstaticvoidmain(String[]args)
{
inti=1;
try
{
ServerSockets=newServerSocket(1111);
for(;;)
{
Socketincoming=s.accept();
System.out.println("connect:"+i);

