Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: How Do I tell if the internet is down



Permlink Replies: 5 - Last Post: Jan 24, 2018 2:53 PM Last Post By: Remy Lebeau (Te...
Donald Bossen

Posts: 81
Registered: 2/3/02
How Do I tell if the internet is down
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 23, 2018 3:38 PM
Here is my code
if ConnectToSqlP21(Msg) then
begin
rez := '800';
ok := True;
repeat
try
Stream := TMemoryStream.Create;
try
Url := ReadIniStr(IniHdwe,'Images',rez) + iPartNo + '.jpg';
idHttp.Get(Url, Stream);
if Stream.Size > 0 then
begin
Stream.Position := 0;
iImage.IO.LoadFromStream(Stream);
Ok := True;
end;
finally
Stream.Free;
end;
except
ok := False;
case StrToInt(Rez) of
800 : rez := '400';
400 : rez := '180';
180 : rez := '75';
75 : begin
iImage.Clear;
Ok := True;
end;
end;
end;
until ok;
end
else

What I am looking at is a case where our network is working but our internet was down and it was locking up about 5 min per image.
Thanks In Advance
Donald S Bossen
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: How Do I tell if the internet is down
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 23, 2018 4:02 PM   in response to: Donald Bossen in response to: Donald Bossen
Donald Bossen wrote:

What I am looking at is a case where our network is working but our
internet was down and it was locking up about 5 min per image.

At which step? The ConnectToSqlP21() call? The IdHTTP.Get() call?
Are you specifying any timeouts for either of them?

--
Remy Lebeau (TeamB)
Donald Bossen

Posts: 81
Registered: 2/3/02
Re: How Do I tell if the internet is down
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 24, 2018 7:51 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
Donald Bossen wrote:

What I am looking at is a case where our network is working but our
internet was down and it was locking up about 5 min per image.

At which step? The ConnectToSqlP21() call? The IdHTTP.Get() call?
Are you specifying any timeouts for either of them?

--
Remy Lebeau (TeamB)

Thanks for your response.
Our Connection to our server (ConnectToSqlP21) is working. Our Internet (IdHTTP.Get() ) is on a different line a local Modem. So it is locking up at the idHTTP.Get call. I have a zero time out on ConnectToSqlP21 In IdHTTP.Get the MaxAuthRetries = 3 no timeouts found.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: How Do I tell if the internet is down
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 24, 2018 10:54 AM   in response to: Donald Bossen in response to: Donald Bossen
Donald Bossen wrote:

In IdHTTP.Get the MaxAuthRetries = 3 no timeouts found.

TIdHTTP has ConnectTimeout and ReadTimeout properties.

--
Remy Lebeau (TeamB)
Donald Bossen

Posts: 81
Registered: 2/3/02
Re: How Do I tell if the internet is down
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 24, 2018 1:28 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
Donald Bossen wrote:

In IdHTTP.Get the MaxAuthRetries = 3 no timeouts found.

TIdHTTP has ConnectTimeout and ReadTimeout properties.

--
Remy Lebeau (TeamB)
Looking at the Object Inspector for TidHttp I see no timeout properties listed. I have not set any timeouts manually for it. If set it is what ever the defaults are.
Thanks Donald S. Bossen
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: How Do I tell if the internet is down
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 24, 2018 2:53 PM   in response to: Donald Bossen in response to: Donald Bossen
Donald Bossen wrote:

Looking at the Object Inspector for TidHttp I see no timeout
properties listed.

The timeout properties I mentioned are public in TIdHTTP, not published.

I have not set any timeouts manually for it.

You should. That way, if there is no Internet connection, or the
connection is lost, TIdHTTP can fail to connect to the server, or fail
to read the full HTTP response, either way raising an exception that
you can catch in your code.

If set it is what ever the defaults are.

The default is 'Infinite'.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02