Recent

Author Topic: How to detect internet connection!  (Read 6319 times)

sstvmaster

  • Full Member
  • ***
  • Posts: 101
Re: How to detect internet connection!
« Reply #30 on: May 23, 2019, 09:41:43 am »
And here you can read how about Windows do that:

https://blog.superuser.com/2011/05/16/windows-7-network-awareness/
Lazarus 2.0.2 x32
Lazarus 2.1.0 Trunk x32
OS Win 7 32bit

engkin

  • Hero Member
  • *****
  • Posts: 2513
Re: How to detect internet connection!
« Reply #31 on: May 23, 2019, 09:42:46 am »
In most cases this can give a good result if someone connects to the internet with a router that is always connected and has no security software running. But in my case I simply opened a program that has no right to connect and then FIREFOX cannot reach a website anymore. As long as the program is in the background.

Which means your software can pinpoint the reason to the user. It can tell if the whole system has no internet or only a probable firewall/AV setting affecting your application. It does not tell you if the server you are trying to reach is down.

engkin

  • Hero Member
  • *****
  • Posts: 2513
Re: How to detect internet connection!
« Reply #32 on: May 23, 2019, 09:50:28 am »
And here you can read how about Windows do that:

https://blog.superuser.com/2011/05/16/windows-7-network-awareness/

Older systems like Windows XP while they do not use *.msftncsi.com, you can still notice the 0.0.0.0 entry when they discover internet connection.

RAW

  • Hero Member
  • *****
  • Posts: 755
Re: How to detect internet connection!
« Reply #33 on: May 23, 2019, 09:51:18 am »
Quote
It does not tell you if the server you are trying to reach is down.
Correct, the server is fine... at least right now ...  :)
Windows 7 Pro (x64 Sp1) And Windows XP Pro (x86 Sp3) - LAZARUS 2.0.2 FPC 3.0.4 - TRUNK 2.1.0 FPC 3.3.1

engkin

  • Hero Member
  • *****
  • Posts: 2513
Re: How to detect internet connection!
« Reply #34 on: May 23, 2019, 09:54:49 am »
Quote
It does not tell you if the server you are trying to reach is down.
Correct, the server is fine... at least right now ...  :)
Blocking access to the server does not mean you do not have access to the internet.

RAW

  • Hero Member
  • *****
  • Posts: 755
Re: How to detect internet connection!
« Reply #35 on: May 23, 2019, 10:04:22 am »
Quote
Blocking access to the server does not mean you do not have access to the internet.

The security software doesn't allow anybody (in this case FIREFOX) to connect to the internet. As long as the forbidden program is running. Internet access (hardware) is definitely possible, but for the normal user it doesn't make a difference. The reason is not visible to the user. I don't know if this is the same with the onboard Windows-Firewall, I never use the windows firewall. I think it's not trustworthy enough...  :)
Windows 7 Pro (x64 Sp1) And Windows XP Pro (x86 Sp3) - LAZARUS 2.0.2 FPC 3.0.4 - TRUNK 2.1.0 FPC 3.3.1

engkin

  • Hero Member
  • *****
  • Posts: 2513
Re: How to detect internet connection!
« Reply #36 on: May 23, 2019, 10:34:25 am »
Quote
Blocking access to the server does not mean you do not have access to the internet.

The security software doesn't allow anybody (in this case FIREFOX) to connect to the internet. As long as the forbidden program is running. Internet access (hardware) is definitely possible, but for the normal user it doesn't make a difference. The reason is not visible to the user. I don't know if this is the same with the onboard Windows-Firewall, I never use the windows firewall. I think it's not trustworthy enough...  :)

I assume the security software would notify the user, and the user is smart enough the realize why the other software is blocked as well despite the fact that the computer does have access to the internet.

My previous post was about the other method of testing internet connectivity using a connection to a server, when that specific server is blocked.

440bx

  • Hero Member
  • *****
  • Posts: 945
Re: How to detect internet connection!
« Reply #37 on: May 23, 2019, 02:56:53 pm »
The security software doesn't allow anybody (in this case FIREFOX) to connect to the internet.
I thought things that did that were called malware....  :D
using FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

RAW

  • Hero Member
  • *****
  • Posts: 755
Re: How to detect internet connection!
« Reply #38 on: May 23, 2019, 05:54:10 pm »
Quote
I thought things that did that were called malware....  :D
Definitely ... In this case malware that I really like to use !!!   :)
Windows 7 Pro (x64 Sp1) And Windows XP Pro (x86 Sp3) - LAZARUS 2.0.2 FPC 3.0.4 - TRUNK 2.1.0 FPC 3.3.1

madref

  • Hero Member
  • *****
  • Posts: 667
  • ..... A day not Laughed is a day not Lived !!
    • Nursing With Humour
Re: How to detect internet connection!
« Reply #39 on: May 23, 2019, 08:16:47 pm »
Quote
This doesn't work on a Mac... to bad  :'(
The WINDOWS API isn't working on a MAC?
Sue Apple !!!  :D


Do you know how??? :P :D
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 2.0.2 / FPC 3.0.4
Lazarus Trunc / FPC 3.0.4
Mac OS X Mojave

RAW

  • Hero Member
  • *****
  • Posts: 755
Re: How to detect internet connection!
« Reply #40 on: May 24, 2019, 05:16:49 am »
I'm working on it ... I let you know !!!
Windows 7 Pro (x64 Sp1) And Windows XP Pro (x86 Sp3) - LAZARUS 2.0.2 FPC 3.0.4 - TRUNK 2.1.0 FPC 3.3.1

ASerge

  • Hero Member
  • *****
  • Posts: 1300
Re: How to detect internet connection!
« Reply #41 on: May 24, 2019, 01:53:38 pm »
When your system discovers that your computer can reach 8.8.8.8 through your router on 192.168.44.1, it adds the 0.0.0.0 entry for you. It will delete this entry when it fails, or when 192.168.44.1 disconnects (hardware) or disappears (Software: ARP packets receive no response).
Complete nonsense. Check in any LAN with the switch or the router. There are stations on the L3 switch or the router will have 0.0.0.0 as the default gateway. So again, all this function checks is that there is a default gateway and it is alive. With the Internet it is connected only if this gateway goes to the Internet, but this check is certainly not here. At home, this is usually the case, but as I said, a couple of stations and one router to the Internet provider - this is not the only possible network configuration.

engkin

  • Hero Member
  • *****
  • Posts: 2513
Re: How to detect internet connection!
« Reply #42 on: May 24, 2019, 05:33:05 pm »
Complete nonsense. Check in any LAN with the switch or the router. There are stations on the L3 switch or the router will have 0.0.0.0 as the default gateway. So again, all this function checks is that there is a default gateway and it is alive. With the Internet it is connected only if this gateway goes to the Internet, but this check is certainly not here. At home, this is usually the case, but as I said, a couple of stations and one router to the Internet provider - this is not the only possible network configuration.
You are right. If the computer is part of a WAN you will have that entry in your forwarding table.

You found a practical example where this method will not work. While it will work in most cases, it is not bulletproof. Probably I can still rely on it to indicate lack of internet.