Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Internet connection test revival
Message
From
06/02/2011 12:36:42
 
 
General information
Forum:
Windows
Category:
API
Miscellaneous
Thread ID:
01498390
Message ID:
01498934
Views:
70
I have used ping with a timer - and an event - is this better ?
set procedure to .\prog\pingevents
?TestPingEvents()
The Ping method starts a ping in another process. You bindevent to PingResult()

The example starts 4 pings in async (with a timer), then suspends awaiting the results

The code of TestPingEvents() ( which you can take out with the #if just above
function TestPingEvents()

	local aa[4], obj, testers[4], i
	aa[1] = 'www.microsoft.com'
	aa[2] = 'www.jdsjldkjdld.com'
	aa[3] = '192.168.0.2'
	aa[4] = 'www.altavista.com'
	
	obj = createobject('ShowPingEvents')
	for i = 1 to alen(aa)
		
		testers[m.i] = createObject(PINGEVENTS_CLASS)
		=bindevent(testers[m.i], 'PingResult', m.obj, 'ShowResult', 1)
		=testers[m.i].Ping(aa[m.i], 8)
	endfor
	suspend && let all terminate
	
endfunc
*_______________________________________________________________________________



*_______________________________________________________________________________
define class ShowPingEvents as relation

*_______________________________________________________________________________
function ShowResult( success, ipOrHostname)

	?m.success, m.ipOrHostname
endfunc
*_______________________________________________________________________________
protected function Destroy()
	
	return DoDefault()
	
endfunc
*_______________________________________________________________________________
enddefine
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform