下面是SCKTSRVR中的代码,希望能有所帮助
procedure TSocketForm.miDisconnectClick(Sender: TObject);
var
i: Integer;
begin
if MessageDlg(SQueryDisconnect, mtConfirmation, [mbYes, mbNo], 0) = mrNo then
Exit;
with SelectedSocket.Socketdo
begin
Lock;
try
for i := 0 to ConnectionList.Items.Count - 1do
with ConnectionList.Itemsdo
if Selected then
TServerClientThread(Data).ClientSocket.Close;
finally
Unlock;
end;
end;
end;