PING pc with FWH

Post Reply
Marc Vanzegbroeck
Posts: 1163
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

PING pc with FWH

Post by Marc Vanzegbroeck »

Hi,

Is is possible to ping with FWH to see if an IP exist or not?

The problem is that that I have a client that is connected with VPN to the SQL-database on the server.
Sometimes he want to work on the same place as where the server is connected, but than he have to connect to the SQL-database with another IP-adres.

I know I can configure the network that the server is always having the same IP.
But it would be easyer to check if the IP exist or not in this case, since I'm not the administrator of that network.

What also could help if to know on what public IP the PC is connected (like www.whatismyip.com), than I also know if he's connected on the network of the server of not.
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
User avatar
cmsoft
Posts: 1297
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina
Been thanked: 2 times

Re: PING pc with FWH

Post by cmsoft »

This is an external solution but it can be useful.

Code: Select all | Expand


nResp := WinExec( "pin.bat",0)
cText := Memoread("c:ping.txt")
IF "no pudo encontrar"$cText .or. "General failure"$cText      
    //Here is your code for when that IP is not available
ENDIF
 

This is the content of the file pin.bat

Code: Select all | Expand


ping 192.168.1.1 -n 1 > ping.txt
 

I hope it helps you.
Marc Vanzegbroeck
Posts: 1163
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: PING pc with FWH

Post by Marc Vanzegbroeck »

Thank you Cesar, I will try this.
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
User avatar
cmsoft
Posts: 1297
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina
Been thanked: 2 times

Re: PING pc with FWH

Post by cmsoft »

Mucho mejor!
Post Reply