PING pc with FWH

PING pc with FWH

Postby Marc Vanzegbroeck » 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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: PING pc with FWH

Postby cmsoft » Mon Dec 06, 2021 11:21 am

This is an external solution but it can be useful.
Code: Select all  Expand view  RUN

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 view  RUN

ping 192.168.1.1 -n 1 > ping.txt
 

I hope it helps you.
User avatar
cmsoft
 
Posts: 1290
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: PING pc with FWH

Postby Marc Vanzegbroeck » 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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: PING pc with FWH

Postby Baxajaun » Mon Dec 06, 2021 11:46 am

User avatar
Baxajaun
 
Posts: 968
Joined: Wed Oct 19, 2005 2:17 pm
Location: Gatika. Bizkaia

Re: PING pc with FWH

Postby cmsoft » Mon Dec 06, 2021 12:37 pm

Mucho mejor!
User avatar
cmsoft
 
Posts: 1290
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Silvio.Falconi and 104 guests