Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Internet connection test revival
Message
From
06/02/2011 09:46:51
 
 
General information
Forum:
Windows
Category:
API
Miscellaneous
Thread ID:
01498390
Message ID:
01498925
Views:
64
>
>Spin whatever it takes off onto another thread? If there's no callback in, say, 10 seconds I'd be happy to assume no connection.


Thought of using async InternetOpenUrl - but then you need a callback capability ( can be found on vfpx)


The only other way around I can see is to do it in another process (exe) which writes the outcome to a text file.

Then in your main app, use a timer to check the existence of the text file. If you find it analyse the contents

You can set the timer interval at half a second

During a timer event
- If you find a successful connection , stop the timer and call a method with success
- if no success and longer than 10 secs, stop the timer and call a method with failure


You can use bindevent to the method that reports success or failure


Update-

Or use ping

Instead of the while loop - you can use a timer
local obj, cmd, filename

filename = 'd:\tmp\1.txt'

obj = createObject('WScript.Shell')

cmd = 'ping www.abc.com >' + m.filename 

delete file (m.filename)


?m.obj.run('%comspec% /c ' + m.cmd, 0, false)


&& This runs quickly ( after two lines are written to the file)

do while !FClose(FOpen(m.filename))

	wait '.' timeout 1
	
enddo

&& This runs only when ping exits

do while !FClose(FOpen(m.filename, 2))

	wait '.' timeout 1
	
enddo


&& analyse output
?FileToStr(m.filename)
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform