FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour PING pc with FWH
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
PING pc with FWH
Posted: Mon Dec 06, 2021 11:05 AM

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
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: PING pc with FWH
Posted: Mon Dec 06, 2021 11:21 AM
This is an external solution but it can be useful.
Code (fw): Select all Collapse
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 (fw): Select all Collapse
ping 192.168.1.1 -n 1 > ping.txt

I hope it helps you.
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: PING pc with FWH
Posted: Mon Dec 06, 2021 11:30 AM

Thank you Cesar, I will try this.

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 990
Joined: Wed Oct 19, 2005 02:17 PM
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: PING pc with FWH
Posted: Mon Dec 06, 2021 12:37 PM

Mucho mejor!

Continue the discussion