Am 24.09.2015 05:24 schrieb "Bo Berglund" <[email protected]>:
>
> On Wed, 23 Sep 2015 17:48:24 -0400, Bo Berglund
> <[email protected]> wrote:
> I added code into the DoRun procedure of the new project so it looks
> like this:
> [code]
> procedure TSSCommTest.DoRun;
> var
>   FComm: TIdTCPClient;
>   T1, T2: Cardinal;
> begin
>   { add your program here }
>   Writeln('Creating TCP client');
>   FComm := TIdTCPClient.Create;
>   try
>     Writeln('Connecting to 10.0.0.7 on port 2401 (CVS)');
>     T1 := GetTickCount;
>     FComm.Connect('10.0.0.7', 2401);
>     T2 := GetTickCount;
>     T2 := T2 - T1;
>     Writeln('Connection succeeded in ' + IntToStr(T2) + ' ms, now
> closing down');
>   finally
>     if FComm.Connected then
>        FComm.Disconnect;
>     FComm.Free;
>   end;
>   // stop program loop
>   Writeln('End of run');
>   Terminate;
> end;
> [/code]
> It compiled fine after I added Windows (for GetTickCount) and
> IdTCPClient to the uses clause.

Since you plan to port to Linux a word of caution: the "Windows" unit
doesn't exist there (and "GetTickCount" does neither), so you either need
to use platform specific functionality from the "BaseUnix" unit or cross
platform one from "SysUtils" and friends.
You should maybe also tale a look into using conditional compilation using
"$ifdef" and the defines the compiler already provides for you (e.g.
"windows", "linux", "unix", "cpui386", "cpuarm", etc.).
Note: in 3.0.0 TThread provides the cross platform class functions
TThread.GetTickCount and TThread.GetTickCount64.

Regards,
Sven
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to