【www.gdgbn.com--js教程】

循环网络服务器编程实现的步骤是这样的:

[url]screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt="click here to open new windownctrl+mouse wheel to zoom in/out";}" onmousewheel="return imgzoom(this);"> [/url]

这种服务器模型是典型循环服务,如果不加上多进程/线程技术,此种服务吞吐量有限,大家都可以看到,如果前一个连接服务数据没有收发完毕后面的连接没办法处理。所以一般有多进程技术,对一个新连接启用一个新进程去处理,而监听socket继续监听。

java代码

  public  boolean getprocess(){
  boolean flag=false;
  try{
  process   p   =   runtime.getruntime().exec( "cmd   /c   tasklist ");
  bytearrayoutputstream   baos   =   new   bytearrayoutputstream();
  inputstream   os   =   p.getinputstream();
  byte   b[]   =   new   byte[256];
  while(os.read(b)> 0)
  baos.write(b);
  string   s   =   baos.tostring();
  // system.out.println(s);
  if(s.indexof( "besttone.exe ")>=0){
  system.out.println( "yes ");
  flag=true;
  }
  else{
  system.out.println( "no ");
  flag=false;
  }
  }catch(java.io.ioexception   ioe){
  }
  return flag;
  }

本文来源:http://www.gdgbn.com/wangyezhizuo/27895/