Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 30385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T13:26:22+00:00 2026-05-10T13:26:22+00:00

Consider the following setup: A windows PC with a LAN interface and a WiFi

  • 0

Consider the following setup: A windows PC with a LAN interface and a WiFi interface (the standard for any new laptop). Each of the interfaces might be connected or disconnected from a network. I need a way to determine which one of the adapters is the one connected to the internet – specifically, in case they are both connected to different networks, one with connection to the internet and one without.

My current solution involves using IPHelper’s ‘GetBestInterface‘ function and supplying it with the IP address ‘0.0.0.0’.

Do you have any other solutions you might suggest to this problem?

Following some of the answers, let me elaborate:

  • I need this because I have a product that has to choose which adapter to bind to. I have no way of controlling the setup of the network or the host where the product will run and so I need a solution that is as robust as possible, with as few assumptions as possible.
  • I need to do this in code, since this is part of a product.

@Chris Upchurch: This makes me dependent on google.com being up (usually not a problem) and on any personal firewall that might be installed to allow pinging.

@Till: Like Steve Moon said, relying on the adapter’s address is kind of risky because you make a lot of assumptions on the internal network setup.

@Steve Moon: Looking at the routing table sounds like a good idea, but instead of applying the routing logic myself, I am trying to use ‘GetBestInterface’ as described above. I believe what it should do is exactly what you outlined in your answer, but I am not really sure. The reason I’m reluctant to implement my own ‘routing logic’ is that there’s a better chance that I’ll get it wrong than if I use a library/API written and tested by more ‘hard-core’ network people.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T13:26:23+00:00Added an answer on May 10, 2026 at 1:26 pm

    Technically, there is no ‘connected to the Internet’. The real question is, which interface is routeable to a desired address. Right now, you’re querying for the ‘default route’ – the one that applies if no specific route to destination exists. But, you’re ignoring any specific routes.

    Fortunately, for 99.9% of home users, that’ll do the trick. They’re not likely to have much of a routing table, and GetBestInterface will automatically prefer wired over wireless – so you should be good. Throw in an override option for the .1% of cases you screw up, and call it a day.

    But, for corporate use, you should be using GetBestInterface for a specific destination – otherwise, you’ll have issues if someone is on the same LAN as your destination (which means you should take the ‘internal’ interface, not the ‘external’) or has a specific route to your destination (my internal network could peer with your destination’s network, for instance).

    Then again, I’m not sure what you plan to do with this adapter ‘connected to the Internet’, so it might not be a big deal.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 112k
  • Answers 112k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer clone.find("span").text("new value"); or clone.find("span").each(function() { $(this).text("new text"); }); or clone.find("span.name").text("new… May 11, 2026 at 9:53 pm
  • Editorial Team
    Editorial Team added an answer These are definitely messages. A "packet" is a layer-3 (in… May 11, 2026 at 9:53 pm
  • Editorial Team
    Editorial Team added an answer Ah, this is because you're trying to do cross-domain requests,… May 11, 2026 at 9:53 pm

Related Questions

Currently all our files are stored on a Windows network drive and with 15
I want to setup a mechanism for tracking DB schema changes, such the one
I was wondering whether the object to test should be a field and thus
I am trying to get the number of students enrolled in courses via a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.