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

Bo Berglund bo.berglund at gmail.com
Fri Jun 18 17:07:05 CEST 2021


On Fri, 18 Jun 2021 16:39:52 +0200, Jean SUZINEAU via fpc-pascal
<fpc-pascal at lists.freepascal.org> wrote:

>I've never used open vpn, may be the 10.117 is defined in your 
>configuration file ?
>
>For the vpns I've used, the ip adressed were fixed.

The tunnel IP address is defined server side and the route is pushed to the
client on connection. A common VPN address in all tutorials starts with 10.8.0
but this is too common so I have set ours as 10.117.xx

>
>( for route, you can type too something like "route print 10.117.*" )
>

C:\>route print 10.117.*
===========================================================================
Interface List
  9...c4 65 16 9d 7e 8e ......Intel(R) Ethernet Connection (7) I219-LM
 16...98 fc 84 ed a3 ea ......Realtek USB GbE Family Controller
  7...00 ff 2d dd 8d be ......TAP-Windows Adapter V9
 21...00 ff 94 a3 1f d4 ......TAP-Windows Adapter V9 #2
 14...d0 c6 37 ea 58 3f ......Intel(R) Wireless-AC 9560 160MHz
 26...d0 c6 37 ea 58 40 ......Microsoft Wi-Fi Direct Virtual Adapter #3
 11...d2 c6 37 ea 58 3f ......Microsoft Wi-Fi Direct Virtual Adapter #4
 10...00 50 56 c0 00 01 ......VMware Virtual Ethernet Adapter for VMnet1
 13...00 50 56 c0 00 08 ......VMware Virtual Ethernet Adapter for VMnet8
 15...d0 c6 37 ea 58 43 ......Bluetooth Device (Personal Area Network)
  1...........................Software Loopback Interface 1
===========================================================================

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
       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
===========================================================================
Persistent Routes:
  None

IPv6 Route Table
===========================================================================
Active Routes:
  None
Persistent Routes:
  None

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
- Parse the output for the expected network address.


-- 
Bo Berglund
Developer in Sweden



More information about the fpc-pascal mailing list