Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Test Internet connection
Message
De
25/01/2011 09:13:34
 
 
À
25/01/2011 09:10:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01497336
Message ID:
01497344
Vues:
57
>>>Hi,
>>>
>>>Anyone know a *quick* way of checking for an Internet connection within a VFP app?
>>>
>>>I've been using the API InternetOpen() followed by InternetOpenUrl()
>>>If there is no problem then this is very fast.
>>>If a connection is disabled then InternetOpen() fails instantaneously (well almost)
>>>
>>>But if there are other problems (eg invalid gateway or router info) then InternetOpenUrl() can take a minute ot so to fail.
>>>For my purposes I'd be quite happy to give up if a valid connection wasn't obtained in, say, 5 seconds.
>>>
>>>I've tried InternetGetConnectedState() and InternetCheckConnection() but they may both result in a 'false positive'
>>>Any other suggestions (has to work for all OSs post Win95....)
>>
>>Viv,
>>
>>I haven't had any problems with this - so far
>>
>>	local Flags
>>	store 0 to Flags
>>	
>>	return !empty(InternetGetConnectedState(@m.flags, 0)) ;
>>		and empty(bitand(m.Flags, INTERNET_CONNECTION_OFFLINE))
>>
>
>As above: I'm getting .T. when, for example, the connection is trying to use an invalid gateway setting....
>
>>As to the time it takes - didn't you like slow (and erratic) ?
>
>Why do you think I'm back on VFP (g,d&r from VFPers)

Don't tell me after two years developing in .NET they've asked you to produce something usable :-)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform