I am asking because sometimes I connect to the Internet via sakis3g script using USB modem, and the network manager status is offline when I do so. So I was wondering if background services know if I am connected or not (or I have to tell them myself)...

2 Answers
2

It's not aware of that. It only knows about local interface configuration and IP routing tables in that sense. Whether they work or not is not something for the OS to keep track of. Applications will find that out by themselves. E.g. A web browser that will time out on requests.

Why isn't this the task of the OS? The connection may be limited intentionally for security reasons for example using a proxy.

It seems to know because of the notifications it shows when I connect to disconnect

No, that's just the local connection of your interface it is reporting the status of. Once IP configuration has completed (either static or DHCP), it will say it's connected. The connection to the internet is the responsibility of your gateway in your network.

How do the background sync services know when I am connected and when to sync data?

They'll have to figure this out by themselves.

Is there something similar to the Windows Connectivity Status Indicator where Microsoft detects Internet connectivity (not just any network connectivity)?

No. Ubuntu does not do any calls to the outside world to check for real internet connectivity.

Well, you can't connect to the Internet. You can only connect to particular computers on the Internet. So a more sensible question is: Is some process keeping track of whether or not particular machines on the Internet are accessible?

The OS and various client-side configuration utilities maintain information about the local and local-area network configuration, possibly including the address of a gateway. And various client-side processes periodically try to access particular machines on the Internet.

If you want an indication of whether or not you can reach an arbitrary machine on the Internet then you can do something like ping 8.8.8.8.