客户端连上服务端后,各使用一个Timer(延时 10秒) 定时发送一个字符进行检测,当客户机连接数量达30以上时整个局域网络网竟然瘫痪了!!!!客户端(还用了一个Timer:Tidclient1.ReadLn('',10),延时为1秒,用来接受服务端发来的各种指令)处于没响应状态,将其结束了,并重启交换机,网络才恢复正常,请问有什么好的方法?谢谢!!!!

解决方案 »

  1.   

    IdTCPServer1.Threads.LockList.count可以获得客户端数量最好做成即作客户端也作服务端模式
      

  2.   

    服务器我是这样检测客户端的:
    try
    ll:=Tcpserver.Threads.LockList;
     with ll do
      begin
      for i:=0 to Count-1 do
         begin
          try
            Tidpeerthread(items[i]).Connection.WriteLn('l');
          except
            Tidpeerthread(Items[i]).Stop;
          end;
         end;
         frm_kz.SeSkinPanel1.Caption:='可操控线程数: '+inttostr(Count);
        end;
     finally
      Tcpserver.Threads.UnlockList;
     end;
      

  3.   

    Dizovin(DIZOVIN) 你好啊!
     
     请问你是否做过这方面的程序啊?关于相互检测,举个例子看看好吗?
    客户端用了一个Timer:Tidclient1.ReadLn('',10),延时为1秒,用来接受服务端发来的各种指令 ,行得通吗?程序运行后,客户机使用起来有点"卡"的感觉啊,有什么好的方法?
      

  4.   

    我怀疑是 Tidclient1.ReadLn 的问题,检查附近的代码,ReadLn用起来很严格的。