Recent

Author Topic: Simple question about TFPHTTPClient.IOTimeout  (Read 530 times)

GAN

  • Sr. Member
  • ****
  • Posts: 252
Simple question about TFPHTTPClient.IOTimeout
« on: January 14, 2020, 10:00:19 pm »
The time unit is milliseconds?
Lazarus 1.8.4 FPC 3.0.4 Linux Mint Mate 17.2 x86_64 GTK-2
Zeos 7.1.3 - Sqlite 3.8.2

Foro Lazarus en español http://forum.lazarus.freepascal.org/index.php/board,73.0.html

lucamar

  • Hero Member
  • *****
  • Posts: 2272
Re: Simple question about TFPHTTPClient.IOTimeout
« Reply #1 on: January 15, 2020, 12:23:26 pm »
It's set in the socket as:

Code: Pascal  [Select]
  1. FIOTimeout:=(time.tv_sec*1000)+(time.tv_usec div 1000);

so yes, it seems IOTimeOut is millliseconds.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.4/2.0.6  - FPC 3.0.4 on:
(K|L)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

GAN

  • Sr. Member
  • ****
  • Posts: 252
Re: Simple question about TFPHTTPClient.IOTimeout
« Reply #2 on: January 15, 2020, 09:22:10 pm »
Hi @lucamar, yes I saw this formula and then posted the question, because it is not clear for me
Code: Pascal  [Select]
  1. (time.tv_sec*1000)
appears to be seconds.
Lazarus 1.8.4 FPC 3.0.4 Linux Mint Mate 17.2 x86_64 GTK-2
Zeos 7.1.3 - Sqlite 3.8.2

Foro Lazarus en español http://forum.lazarus.freepascal.org/index.php/board,73.0.html

Thaddy

  • Hero Member
  • *****
  • Posts: 9449
Re: Simple question about TFPHTTPClient.IOTimeout
« Reply #3 on: January 15, 2020, 09:43:18 pm »
« Last Edit: January 15, 2020, 09:57:12 pm by Thaddy »
also related to equus asinus.

GAN

  • Sr. Member
  • ****
  • Posts: 252
Re: Simple question about TFPHTTPClient.IOTimeout
« Reply #4 on: January 15, 2020, 11:40:40 pm »
@Thaddy thanks for the link, but they must be milliseconds because with values less than 200 (approx.) I get 90% errors and with value of 1000/1500 works fine.

Lazarus 1.8.4 FPC 3.0.4 Linux Mint Mate 17.2 x86_64 GTK-2
Zeos 7.1.3 - Sqlite 3.8.2

Foro Lazarus en español http://forum.lazarus.freepascal.org/index.php/board,73.0.html

lucamar

  • Hero Member
  • *****
  • Posts: 2272
Re: Simple question about TFPHTTPClient.IOTimeout
« Reply #5 on: January 16, 2020, 02:02:02 pm »
Hi @lucamar, yes I saw this formula and then posted the question, because it is not clear for me
Code: Pascal  [Select]
  1. (time.tv_sec*1000)
appears to be seconds.

Of course: time.tv_sec is seconds, which multiplied by 1000 give milliseconds; time.tv.usec are microseconds which divided by 1000 give, again, milliseconds.

The links posted by Thaddy are (somewhat) useful to know why a time struct has to be used: for the system call that implements the timer. But Thaddy, note:

Resolution is either seconds or nanoseconds.

That is correct when you (have to) use the struct timespec, but the structure used here is timeval, which has only seconds and microseconds.

HTH!
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.4/2.0.6  - FPC 3.0.4 on:
(K|L)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

GAN

  • Sr. Member
  • ****
  • Posts: 252
[SOLVED] Re: Simple question about TFPHTTPClient.IOTimeout
« Reply #6 on: January 16, 2020, 10:49:06 pm »
Thanks @lucamar and @Thaddy.
Lazarus 1.8.4 FPC 3.0.4 Linux Mint Mate 17.2 x86_64 GTK-2
Zeos 7.1.3 - Sqlite 3.8.2

Foro Lazarus en español http://forum.lazarus.freepascal.org/index.php/board,73.0.html