Advertisement
Guest User

Untitled

a guest
Oct 17th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.78 KB | None | 0 0
  1. //Testa se um servidor proxy está ativo
  2. //Adicione 1 button.
  3. //Adicione 2 edit.
  4. //Adicione 1 memo.
  5. //by SuPrEm3 (Daniel/Nerd)
  6. //Object Pascal - Delphi
  7.  
  8. function TestaProxy(host: string; port: word):boolean;
  9. var
  10.    TcpClient1: TTcpClient;
  11. begin
  12.    try
  13.     TcpClient1:=TTcpClient.Create(neo);
  14.     TcpClient1.RemoteHost:=Host;
  15.     TcpClient1.RemotePort:=IntToStr(porta);
  16.     if TcpClient1.Connect
  17.       then begin
  18.     result:= true;
  19.     TcpClient1.Disconnect;
  20.    end
  21.     else result:= false;
  22.    finally
  23.   TcpClient1.Free;
  24.  end;
  25. end;
  26.  
  27. procedure TForm1.Button1Click(Sender: TObject);
  28. begin
  29. if TestaProxy(Edit1.Text, StrToInt(Edit2.Text)) then
  30.       begin
  31.     Memo1.Lines.Add('Proxy ativo!');
  32.      end else
  33.       begin
  34.     Memo1.Lines.Add('Proxy inativo!');
  35.     end;
  36. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement