我的客户端代码如下:
客有一个多线程程序用于接收从服务器发送过来的信息:
procedure TReceiveThread.Execute;
begin
  while not terminated do
  DoExecute(Fmain.Client1);
end;procedure  TReceiveThread.DoExecute(Icon: TIDTcpClient);
begin
  Icon.ReadBuffer(RHead,sizeof(Rhead));//发送一个头部
  case Rhead.Cmid of
    Cmid_onlineuserCount: GetonLineuserCount(ICON);//接收其它信息
    cmid_SS:SS(icon); 
    CMID_DDD:DDD(icon);
    .....   这些都能正常接收
    Cmid_Discon: DisConn;
  end;
end;procedure TReceiveThread.DisConn;//断开连接
begin
  While Fmain.Client1.Connected do
  begin
    Fmain.GReceiveThread.Terminate;
    Fmain.Client1.Disconnect;
  end;
end;procedure TFMain.Button1Click(Sender: TObject);
begin
  try
    sendHead(Fmain.Client1,Cmid_Discon);//发送请求断开信息
  except
  end;
end;
服务器端:procedure TForm1.Server1Execute(AThread: TIdPeerThread);
var Lhead: Khead;
begin
  with AThread do begin
    Athread.Connection.ReadBuffer(lhead,Sizeof(lhead));
    Case lhead.Cmid of
      Cmid_login:Login(AThread);
      Cmid_onlineuserCount: GetonLineuserCount(AThread);
      Cmid_discon: begin
        sendhead(Athread,Cmid_Discon);
        Athread.Terminate;//每次到这儿都出异常
        //Athread.connection.disconect;//出现同样的异常,弄了好久郁决了,请高手帮忙
      end;
    end;
  end;
end;地址异常错误,只有断开的时候才出来现这样的错误,其它数据接收发送完全正常