Recent

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

GAN

  • Sr. Member
  • ****
  • Posts: 370
Simple question about TFPHTTPClient.IOTimeout
« on: January 14, 2020, 10:00:19 pm »
The time unit is milliseconds?
Lazarus 2.0.8 FPC 3.0.4 Linux Mint Mate 19.3
Zeos 7̶.̶2̶.̶6̶ 7.1.3a-stable - Sqlite 3.32.3 - LazReport

lucamar

  • Hero Member
  • *****
  • Posts: 4219
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/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

GAN

  • Sr. Member
  • ****
  • Posts: 370
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 2.0.8 FPC 3.0.4 Linux Mint Mate 19.3
Zeos 7̶.̶2̶.̶6̶ 7.1.3a-stable - Sqlite 3.32.3 - LazReport

Thaddy

  • Hero Member
  • *****
  • Posts: 14364
  • Sensorship about opinions does not belong here.
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 »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

GAN

  • Sr. Member
  • ****
  • Posts: 370
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 2.0.8 FPC 3.0.4 Linux Mint Mate 19.3
Zeos 7̶.̶2̶.̶6̶ 7.1.3a-stable - Sqlite 3.32.3 - LazReport

lucamar

  • Hero Member
  • *****
  • Posts: 4219
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/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

GAN

  • Sr. Member
  • ****
  • Posts: 370
[SOLVED] Re: Simple question about TFPHTTPClient.IOTimeout
« Reply #6 on: January 16, 2020, 10:49:06 pm »
Thanks @lucamar and @Thaddy.
Lazarus 2.0.8 FPC 3.0.4 Linux Mint Mate 19.3
Zeos 7̶.̶2̶.̶6̶ 7.1.3a-stable - Sqlite 3.32.3 - LazReport

 

TinyPortal © 2005-2018