[fpc-pascal] How to check if a network is available?
Bo Berglund
bo.berglund at gmail.com
Fri Jun 18 16:02:52 CEST 2021
On Fri, 18 Jun 2021 15:00:18 +0200, Jean SUZINEAU via fpc-pascal
<fpc-pascal at lists.freepascal.org> wrote:
>May be you can get some information with the "route" command .
>
>If you run "route print" in cmd command prompt, you can get information
>on the different networks available.
>
>https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/route_ws2008
>
>(I couldn't find the doc for Windows 10, but "route print" works on
>Windows 10 Pro)
>
>May be you can run the command "route print 0.0.0.0 " with TProcess and
>parse the output ?
>
On command line (grep is available from a delphi):
C:\>route print | grep 10.117
File STDIN:
10.117.3.0 255.255.255.0 On-link 10.117.3.2 281
10.117.3.2 255.255.255.255 On-link 10.117.3.2 281
10.117.3.255 255.255.255.255 On-link 10.117.3.2 281
224.0.0.0 240.0.0.0 On-link 10.117.3.2 281
255.255.255.255 255.255.255.255 On-link 10.117.3.2 281
If I know beforehand which will be the IP address of the VPN network I could use
this...
--
Bo Berglund
Developer in Sweden
More information about the fpc-pascal
mailing list