[fpc-pascal] How to check if a network is available?

Marc Weustink marc at dommelstein.nl
Fri Jul 2 20:08:24 CEST 2021


On 18-6-2021 13:49, Bo Berglund via fpc-pascal wrote:
> I would like to know how I can check if a remote network is available, i.e. if
> the VPN system has succeeded to connect the remote network.
> 
> I need this in a class that connects an OpenVPN tunnel on demand and takes it
> down after use. Unfortunately openvpn-gui does not have an API call to do
> this...
> It provides an API for connect, disconnect, reconnect etc but not for returning
> the state of a connection for example.
> https://github.com/OpenVPN/openvpn-gui#send-commands-to-a-running-instance-of-openvpn-gui
> 
> Any suggestions for Windows?
> I just want to know if a call to connect succeeded.

You can use the management interface
  https://openvpn.net/community-resources/management-interface/

But since we are developers you can lookup this info with the windows 
function GetIpAddrTable

 
https://docs.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-getipaddrtable

Marc


More information about the fpc-pascal mailing list