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

Jean SUZINEAU jean.suzineau at wanadoo.fr
Fri Jun 18 17:31:27 CEST 2021


Le 18/06/2021 à 17:07, Bo Berglund via fpc-pascal a écrit :
> I will need to check this in my connector class, the address to look for has to
> be a config item in my application so it can be modified if need be without
> rebuilding the app.
> Have to figure out how to:
> - Retrieve the output of the TProcess execution
There are many ways to cook TProcess ...
I think you'll find what you need at :

https://wiki.freepascal.org/Executing_External_Programs

> - Parse the output for the expected network address.
My idea would be to store the output in a Stringlist as shown in the 
examples,  then with IndexOf you can locate the position of  lines like 
"IPv4 Route Table" and "Persistent Routes:" and make a more detailed 
parsing between the two.


More information about the fpc-pascal mailing list