procedure TForm1.Timer1Timer(Sender: TObject);
var
I : integer;
begin
Memo1.Clear;
for I := 0 to 1000 do begin
ServerSocket1.Close;
ServerSocket1.Port := I;
try
ServerSocket1.Open;
except
Memo1.Lines.Add(IntToStr(I) + '端口被打开!');
end;
end;
Timer1.Enabled := FALSE;
end;