> >
> >
> > 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.
>
>
>
> Thank you for helping me about the ping issues, but recently i have found a new and easier solution.
>
> i just tried adding "OPTION=3" to my connection string, and here it goes:
>
> Driver=MySQL ODBC 3.51 Driver;Server=TheIPAdd;Port=ThePort;Database=TheDatabase;User=Root;Password=Root;Option=3;
>
> There ^_^. the mysql login window won't pop-up.
>
> but pinging the server is more challenging, fun, exiting...
> thnk again...
Jorrel,
Just pinging the server won't tell you whether you are connected(logged on) or not.
It won't even tell you whether you have access to the server or domain. All it will tell you is whether the machine is turned on or not.
If the server is on, the ping will return four responses. If it isn't, you will get errors.
To confirm you are connected, and can read/write files to it, just copy a small .txt file
to it. Then check for it's existence(DOS='If Exist myfilename',VFP='If File 'myfilename')
will tell you whether or not you are talking or not.
This is the simple approach. You can do the same thing through Windows API's, but with more coding.
Woops! I think Pete's approach will also verify that you are in fact online with the server!
I did not read his reply as closely as I should have. Sorry.
Pat