如何用J4V4来做编程

作者:张丽 | 原创 | 2008-05-11 01:36 | 投票
标签: 信息产业 
  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);

 [1] [2] [3] [4] [5] [6] [7] 
个人简介
Baidu 广告
Google 广告