Forum > Portuguese
2 Problemas time out ou ping.
(1/1)
ClaudioBorba:
Olá, compilando para LInux estamos com 2 problemas:
1 - Time out de conexão firebird demora quase 3 minutos no linux.
2- Ping só funciona se executar o aplicativo como root.
Linux Mint 21.3
Firebird 4.0
Lazrus 3.0
ClaudioBorba:
Resolvido.
olá, pesquisando bastante consegui fazer com esse codigo ping para linux e windows.
unit uUtil;
{$mode ObjFPC}{$H+}
interface
uses
Classes, SysUtils , process;
function PingHost(Host:String) : Boolean;
implementation
function PingHost(Host: String): Boolean;
var Proc: TProcess;
St :TStringList;
begin
Proc := TProcess.Create(nil);
St := TStringList.Create;
{$IFDEF WINDOWS}
Proc.Executable := 'cmd';
Proc.Executable := 'ping';
Proc.Parameters.Add(Host);
Proc.Options := Proc.Options + [poWaitOnExit, poUsePipes];
Proc.Execute;
St.LoadFromStream(Proc.Output);
Result := (Pos('Resposta',St.Text) > 0);
{$ELSE}
Proc.Executable := 'ping';
Proc.Parameters.Add('-c');
Proc.Parameters.Add('2');
Proc.Parameters.Add(Host);
Proc.Options := Proc.Options + [poWaitOnExit, poUsePipes];
Proc.Execute;
St.LoadFromStream(Proc.Output);
Result := (Pos('icmp_seq',St.Text) > 0);
{$ENDIF}
end;
end.
Navigation
[0] Message Index