Pretty stupid way of determining that something is pirated. Especially when you have a setting to launch at startup.
jpp72
Don't forget to mention that the autostart is enabled by default (I believe it is like that, correct me if I'm wrong)
I mean I would probably never launch StreamFab manually while disconnected from the internet.
And if it's an auto start, I'd say you could probably even have a tray application that patiently pings example.org and waits for it to be reachable.
Or you use Microsoft APIs... YEP, I knew it
You can use "InternetGetConnectedState"
BELOW is a code example for python (which Streamfab already makes use of so... idk feels like this would be a simple implementation)
import ctypes
# Load the Wininet library
wininet = ctypes.windll.wininet
# Define the flags
INTERNET_CONNECTION_MODEM = 0x01
INTERNET_CONNECTION_LAN = 0x02
INTERNET_CONNECTION_PROXY = 0x04
INTERNET_CONNECTION_OFFLINE = 0x20
INTERNET_CONNECTION_CONFIGURED = 0x40
def interpret_flags(flags):
states = []
if flags & INTERNET_CONNECTION_MODEM:
states.append("Modem")
if flags & INTERNET_CONNECTION_LAN:
states.append("LAN")
if flags & INTERNET_CONNECTION_PROXY:
states.append("Proxy")
if flags & INTERNET_CONNECTION_OFFLINE:
states.append("Offline")
if flags & INTERNET_CONNECTION_CONFIGURED:
states.append("Configured")
return states
def get_connection_state():
flags = ctypes.c_ulong()
result = wininet.InternetGetConnectedState(ctypes.byref(fla gs), 0)
return result, flags.value
result, flags = get_connection_state()
if result:
print("Connected to the internet")
print("Connection types:", interpret_flags(flags))
else:
print("Not connected to the internet")
print("Connection types:", interpret_flags(flags))
It's worth noting that this only confirms connection to a local area network.
To ensure the computer has a connection to the internet, I'd suggest pinging example.org for a connection.
That domain afaik is run by
ICANN and is much like Google always gonna be online.
Unlike Google, ICANN is a non-profit and operation of example.org and example.com is expected to exist for as long as the internet lives.