All pastes #28920 Raw Edit

Server Port Checker

public text v1 · immutable
#28920 ·published 2005-11-16 17:05 UTC
rendered paste body
procedure TForm1.Button1Click(Sender: TObject);
var
  i:integer;
begin
  TcpClient.Active := False;
  
  for i := 0 to listviewServers.Items.Count - 1  do
  begin
    Connected := False;
    Error := False;
    TcpClient.Active := False;
    TcpClient.RemotePort := '4899';
    TcpClient.RemoteHost := listviewServers.Items.Item[i].SubItems[0];
    if Connected = True then //the bools tell the app that a port is open
    begin
      listviewServers.Items.Item[i].SubItems[1] := 'Online';
      TcpClient.Active := False;
    end
    else if Error = True then
    begin
      listviewServers.Items.Item[i].SubItems[1] := 'Offline';
      TcpClient.Active := False;
    end;
  end;

end;

procedure TForm1.TcpClientConnect(Sender: TObject);
begin
  Connected := True;
end;

procedure TForm1.TcpClientError(Sender: TObject; SocketError: Integer);
begin
  Error := True;
end;