0

I have code that goes on a LAN hosted server to get some information. This LAN server is of course only available when you are connected to the right internet connection.

Is there a way of which I can check what connection the PC is using, so I don't try to scrape the server without there being a connection?

I already do a try and except setup to catch the exception that is thrown when the server doesn't answer 'cause you're connected to a wrong internet. This lags the program heavily, so I was hoping that there were some way via 'OS' of checking what internet I am connected to?

I was hoping that something along the lines of this was possible:

If(internetConnectionName == “[name of internet]”
    {
       #Usable code...
    }
    Else
    {
       #Other code
    }

The above is of course pseudo code.

T. Aalbaek
  • 23
  • 2
  • 10
  • Just ping it to see if it exists? or use WMI to get the gateway your connected to – TheGeneral Oct 21 '18 at 07:50
  • Possible [duplicate](https://stackoverflow.com/questions/2031824/what-is-the-best-way-to-check-for-internet-connectivity-using-net)... – Peter Schneider Oct 21 '18 at 08:10
  • @PeterSchneider I wouldn't say that it is, as the other post just wants to know if there is an internet connection. Where as I wanna check what internet (LAN) network I'm connected to. – T. Aalbaek Oct 22 '18 at 08:58

0 Answers0