Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Internet connection test revival
Message
From
02/02/2011 15:40:06
 
 
General information
Forum:
Windows
Category:
API
Miscellaneous
Thread ID:
01498390
Message ID:
01498406
Views:
70
>Hi,
>
>Finally got back to doing some more testing of the last code you sent.
>Unfortunately, if I set up a connection with an invalid gateway, then the API call to GetHostByName is slow.....
>As of now I can't see a way around that one ?
>
>Best,
>Viv



Viv,

I've made it so that GetHostByName() is only called if you use www.xxxx.xx style
If you pass an ip address - it does not call GetHostByName()

See class IPADRESSBITS_CLASS method ResolveHost()

Would that work for you ?
local success
success = true

local obj

local ipOrHostname, millisecondsTimeOut

local replyAddress, replyStatus, replyRoundTripTime, replyDataSize, replyData

ipOrHostname = '68.180.206.184' && Altavista.com from http://www.ip-adress.com/whois/altavista.com

millisecondsTimeOut = 1000

? m.ipOrHostname

do case
case !m.success

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

case !m.obj.Ping( ;
			m.ipOrHostname, ;
			m.millisecondsTimeOut, ;
			@m.replyAddress, ;
			@m.replyStatus, ;
			@m.replyRoundTripTime, ;
			@m.replyDataSize, ;
			@m.replyData ;
		)
	?? '	Failed'


otherwise
	?? '	ms= ', replyRoundTripTime, 'address = ', replyAddress, ' received: ', m.replyData 
	

endcase
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform