> Hello there! Can someone help me about pinging an ip address? im using MySQL as my backend but everytime the server is down, the MySQL ODBC connection settings always pop up. If i could just ping the ip address on the first place i could control the errors occuring. Or maybe to add additional control in the connection string to block the pop-up window.
>
> and one more thing... how can i check if the server is still active? Ex: I am connected to the server and suddenly the connetion broke.
>
> Thank you...
Morning from Canada,
If you need to ping an ip address to verify if the server
is attached on your network the below code works as I am
using it all the time.
* --- PingAPI.prg - Coded as a function.
* --- Format : lIPthere=PingAPI("10.162.15.75")
LPARAMETERS lChkIP
DECLARE INTEGER GetRTTAndHopCount IN Iphlpapi;
INTEGER DestIpAddress, LONG @HopCount,;
INTEGER MaxHops, LONG @RTT
DECLARE INTEGER inet_addr IN ws2_32 STRING cp
LOCAL nHop, nRTT
nIPDest = inet_addr(lChkIP)
IF GetRTTAndHopCount(nIPDest, @nHop, 1, @nRTT) <> 0
RETURN .T.
ELSE
RETURN .F.
ENDIF
Pete "the IceMan", from the Great White North of Canada.