你是说在链表中清除吗?我在
procedure TfrmMain.tcpServerDisconnect(AThread: TIdPeerThread);
var
  Client : TSimpleClient;
  sql :string;
  sPhone:string;
  Logofftime:string;
  //index:integer;
begin
  Client := Pointer(AThread.Data);
  Clients.Delete(Client.ListLink);
  lbClients.Items.Delete(lbClients.Items.IndexOf(Client.Name));
  sPhone:=Client.Name;
  Client.Free;
  AThread.Data := nil;
  这样清楚对吗?
  终端链表与listbox对应,Client.ListLink是其索引。
  

解决方案 »

  1.   

    Client : TSimpleClient; 
    咋写的?
      

  2.   

    你贴出来的程序与indy中的demo基本一致,
    相信TSimpleClient的定义也差不多
    我暂时没有看出什么问题
    自己再仔细研究一下demo吧
      

  3.   

    呵呵~可以使用俺开发的平台的,专门针对DTU连接主服务器设计的
      

  4.   

    看了看demo,还是不行啊?delphi驾驭不了啊
      

  5.   

    谢谢SuperTitan001的提醒,我改了下程序,当gprs重新连接时,服务器并不向先前的gprs发送数据了。但是先前的连接还存在,真是无语了。各位大侠帮帮忙吧。
    代码:
    {=================================
    功能:处理已登录的终端重新登录
    参数:gprsClient:登录的终端
    返回值:无
    ==================================}
    procedure TfrmMain.HandleClient(gprsClient: PClient);
      var
        cindex:integer;
        Client:PClient;
    begin
        cindex := IsInClients(gprsClient.Name);       //查找先前终端链表中的索引
        if (cindex <> -1) then
        begin
        try
           try
            Client := Clients.LockList.Items[cindex];
            TIdPeerThread(Client.Thread).Connection.Disconnect;
           except
           TIdPeerThread(Client.Thread).stop;
           end;
        finally
           Clients.UnlockList;
        end;
        end;
    end;function TfrmMain.IsInClients(sp: string): integer;
      var
     // Count : Integer;
      oldClient:PClient;
      i:integer;
    begin
    { Loop through all the clients connected to the system and set their names }
    try
     with Clients.LockList do
     begin
       for i := 0 to Count-1 do
       begin
       oldClient:=Items[i];
       if oldClient.Name=sp then
          begin
          result:=i;
          exit;
          end
       end;
       end;
     finally
     Clients.UnlockList;
     end;
     result:=-1;