 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Thebes Guest
|
Posted: Sat Jun 28, 2003 6:18 pm Post subject: detect internet connection |
|
|
hi...
can we check internet connection avaible with aynway (adsl,cable dialup,lan
etc.) without checking an internet adress? is tehere an api for this? or
must I ping or finger a valid adress?
|
|
| Back to top |
|
 |
Maynard Philbrook Guest
|
Posted: Sat Jun 28, 2003 7:14 pm Post subject: Re: detect internet connection |
|
|
There are problems detecting that.
i have found it unreliable.
if you perform a DNS it should work for you.
if the users system uses a Dial up and its set for autodial then the
socket system should initiate a dial up and when connected the
call will return how ever, there is a problem here.
if for some reason the dial up fails the next attempt will fail until you
unload the Wsock DLL so that the host dial app will unload.
or if you want you can use the EnumWindows to detect if this is the case
and kill the app via a message and then try again.
also if you look in the Current_USer key of the reg you will find the
RemoteAccess info if it exists.
also there is an API cal only on systems that uses IE 4.0+
i think its called InternetGetConnectionState
you Need to use the WinInet unit..
how ever this call i have found to also be alittle unreliable.
Look in the MSDN for Wininet APi.,
Thebes wrote:
| Quote: | hi...
can we check internet connection avaible with aynway (adsl,cable dialup,lan
etc.) without checking an internet adress? is tehere an api for this? or
must I ping or finger a valid adress?
|
|
|
| Back to top |
|
 |
Ruggero Rossi Guest
|
Posted: Mon Jun 30, 2003 6:58 am Post subject: Re: detect internet connection |
|
|
In the wininet there is the function you need: InternetGetConnectedState
function IsOnLine: boolean;
var
dwConnectionTypes : DWORD;
begin
dwConnectionTypes :=
INTERNET_CONNECTION_MODEM +
INTERNET_CONNECTION_LAN +
INTERNET_CONNECTION_PROXY;
result := InternetGetConnectedState(@dwConnectionTypes,0);
end;
"Thebes" <t_h_e_b_e_s (AT) yahoo (DOT) com> ha scritto nel messaggio
news:3efddbe3 (AT) newsgroups (DOT) borland.com...
| Quote: | hi...
can we check internet connection avaible with aynway (adsl,cable
dialup,lan
etc.) without checking an internet adress? is tehere an api for this? or
must I ping or finger a valid adress?
|
|
|
| Back to top |
|
 |
Francois Piette Guest
|
Posted: Mon Jun 30, 2003 7:20 am Post subject: Re: detect internet connection |
|
|
| Quote: | In the wininet there is the function you need: InternetGetConnectedState
|
This function returns the settings from Internet Explorer and doesn't always
reflect the truth...
IMHO there is _NO_ universal way to know programmatically how the user is
connectect to the internet without asking the user (and using IE settings is
asking the user indirectly).
--
Contribute to the SSL Effort. Visit
http://overbyte.delphicenter.com/eng/ssl.html
--
[email]francois.piette (AT) overbyte (DOT) be[/email]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be
"Ruggero Rossi" <ruggero.maria.rossi (AT) libero (DOT) it> a écrit dans le message de
news:3effdfa4$1 (AT) newsgroups (DOT) borland.com...
| Quote: | In the wininet there is the function you need: InternetGetConnectedState
function IsOnLine: boolean;
var
dwConnectionTypes : DWORD;
begin
dwConnectionTypes :=
INTERNET_CONNECTION_MODEM +
INTERNET_CONNECTION_LAN +
INTERNET_CONNECTION_PROXY;
result := InternetGetConnectedState(@dwConnectionTypes,0);
end;
"Thebes" <t_h_e_b_e_s (AT) yahoo (DOT) com> ha scritto nel messaggio
news:3efddbe3 (AT) newsgroups (DOT) borland.com...
hi...
can we check internet connection avaible with aynway (adsl,cable
dialup,lan
etc.) without checking an internet adress? is tehere an api for this? or
must I ping or finger a valid adress?
|
|
|
| Back to top |
|
 |
Ruggero Rossi Guest
|
Posted: Tue Jul 01, 2003 4:09 pm Post subject: Re: detect internet connection |
|
|
"Francois Piette" <francois.piette (AT) overbyte (DOT) be> ha scritto nel messaggio
news:3effe4b4 (AT) newsgroups (DOT) borland.com...
| Quote: | In the wininet there is the function you need: InternetGetConnectedState
This function returns the settings from Internet Explorer and doesn't
always
reflect the truth...
|
Is it? This function, as in msdn documentation, "Retrieves the connected
state of the local system", not "connection settings".
I tried this funcion with and without connection, and the return value was
different.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/win
inet/internetgetconnectedstate.asp
Hi,
Ruggero
....
|
|
| Back to top |
|
 |
Francois PIETTE Guest
|
Posted: Tue Jul 01, 2003 4:37 pm Post subject: Re: detect internet connection |
|
|
| Quote: | In the wininet there is the function you need:
InternetGetConnectedState
This function returns the settings from Internet Explorer and doesn't
always reflect the truth...
Is it? This function, as in msdn documentation, "Retrieves the connected
state of the local system", not "connection settings".
I tried this funcion with and without connection, and the return value was
different.
|
Yes but you have IE with correct settings.
Change the setting of IE, setting something incorrect, then you'll see the
function return a wrong result. So the connected state only reflect IE
settings. If your application runs on a systel where IE is not correctly
configured (for example because the user is using Mozilla and don't care
about IE) then your program will not work as expected. But maybe I'm
wrong...
--
Contribute to the SSL Effort. Visit
http://overbyte.delphicenter.com/eng/ssl.html
--
[email]francois.piette (AT) overbyte (DOT) be[/email]
The author for the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|