IndyTCPServerとTCPClientを備えたDelphiアプリケーションがあります。AContext.Bindind.Handle
各接続の識別にを使用します(間違っていますか?)。
したがって、接続を表示するグリッドがあり、切断後にエントリを削除します。
procedure TfrmMain.serverIndyDisconnect(AContext: TIdContext);
var I:Integer;
begin
for I := 0 to gridClients.RowCount - 1 do
begin
if gridClients.Cells[0, I] = IntToStr(AContext.Binding.Handle) then
begin
gridClients.Rows[I].Delete(I);
end;
end;
WriteLogEntry('Connection closed... (' + AContext.Binding.PeerIP+')');
end;
ただし、Disconnectイベントでは、ハンドルはすでに空です(401xxxxxであるため、最後の整数)。
アイデア?