Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Test Internet connection
Message
From
25/01/2011 17:26:17
 
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01497336
Message ID:
01497395
Views:
49
>>>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.
>>
>>This is one of the best examples of useful multi-threading (or the substitutes necessary in vfp single thread...). If this is the only MT task, I'd go for a simple check in separate process writing out a file and loop with sleep-calls (or ww, as they also induce vfp-wait states) for 5s or the file is created. KISS is not always bad...
>
>You lost me. I know that if this was .Net I could hive the process off onto a separate thread - but I'd still have to wait for the result.
>Bottom line is that I'm happy to accept that if no Internet access can be confirmed in five or ten seconds then it is not available.
>I'm also not worried about maintaining any type of user interactivity whilst the check is in progress so single-threading is not a problem.

for the separate thread/process part, in simplest form in a separate exe
lpara tcfile
return StrToFile(transform(YourPossiblylongWindedInternetCheck(), m.tcFile)
base code for your fast check
local lcFile, ldExit, llHas
lcFile = sys(2015)
if file(m.lcFile)
   dele file  (m.lcFile)
endif
ldExit = datetime() + 5
CallExtProcess(m.lcFile)
do while datetime() < m.ldExit

  wait wind Datetime() timeout 1
  if file(m.lcFile)
     lcTmp = FileToStr(m.lcFile)
     llHas = eval(lcTmp)
     exit
  endif
enddo
Previous
Reply
Map
View

Click here to load this message in the networking platform