Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Test Internet connection
Message
From
26/01/2011 12:14:10
 
 
To
26/01/2011 11:43:36
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01497336
Message ID:
01497463
Views:
60
>>>>>>>
>>>>>>
>>>>>>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
>>>>>
>>>>Thank you! - that looks excellent. Won't have time to look at it properly until later (one immediate snag though - I'm on VPF 8 so CTOBIN() doesn't support the flags parameter....)
>>>
>>>
>>>
>>>
>>>Oh, I can change that easily - will post a modified version later
>>>
>>>And - I use sys(2600) - does vfp 8 support sys(2600) ?
>>
>>Yep :-} (looks like the same implementation)
>
>Ok, version #2, vfp8 compatible, attached

BINTOC() also used a non-VFP 8.0 implementation but other than that it works beautifully. Thank you!

>Update: this may also be a possibility http://msdn.microsoft.com/en-us/library/aa366013(VS.85).aspx

I think I'd need to use this against a url so resolving that to an ip address probably makes that option more complex than the IcmpSendEcho2....
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform