Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Test Internet connection
Message
From
26/01/2011 08:56:41
 
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01497336
Message ID:
01497442
Views:
83
>>
>
>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)


I have attached a class that allows you to ping using IcmpSendEcho2 : This needs at least windows 2000 in order to use IcmpSendEcho2()
The tabs in there may seem a bit erratic - my tabstop is set to 4

I have translated the example from http://msdn.microsoft.com/en-us/library/aa366051(VS.85).aspx

Want to try ?

Sample code
#define true	.T.
#define false	.F.

set procedure to .\prog\PingBits additive

local success
success = true


local obj

local replyAddress, ;
		replyStatus, ;
		replyRoundTripTime, ;
		replyDataSize, ;
		replyData

local pingArray[4]
pingArray[1] = '192.168.0.2'
pingarray[2] = 'www.altavista.com'
pingarray[3] = 'www.levelextreme.com'

pingarray[4] = 'www.abc.pp.com'

do case
case !m.success

case !PingBits_Object(@m.obj)
	assert false
	success = false

otherwise
	local site, reachable
	
	
	for each site in pingarray
		?m.site, chr(0x09)
		reachable= m.obj.Ping( ;
						m.site, ;
						1000, ;
						@m.replyAddress, ;
						@m.replyStatus, ;
						@m.replyRoundTripTime, ;
						@m.replyDataSize, ;
						@m.replyData ;
						)
		
		if( !m.reachable)
			?? 'Failed'
		
		else
			?? 'ms= ', replyRoundTripTime, 'address = ', replyAddress, ' received: ', m.replyData 
		
		endif
		
	endfor

endcase
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform