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

Tony Whyman tony.whyman at mccallumwhyman.com
Fri Jun 18 15:03:17 CEST 2021


Yep, that's the golden rule in networking. The only way that you know 
that a bi-directional path is open is an end-to-end ping. Even then, you 
only know that it's open at the time the ping completed.

If you are using TCP then you can always enable keepalive packets that 
effectively do the same thing while the TCP connection is open. The 
IPsec Internet Key Exchange Protocol also has the same capability for 
Dead Peer Detection (DPD) which works between the two end points of a 
VPN tunnel.

On 18/06/2021 13:34, James Richters via fpc-pascal wrote:
> Do a Ping to an address on the network to see if it's connected?
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
> 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.



More information about the fpc-pascal mailing list