So, I have an application in Python, but I want to know if the computer (which is running the application) is on, from another remote computer.
Is there any way to do this? I was thinking to use UDP packets, to send some sort of keep-alive, using a counter. Ex. every 5 mins the client sends an UDP 'keep-alive' packet to the server. Thanks in advance!
yes thats the way to go. kind of like sending heartbeat ping. Since its UDP and since its just a header message you can reduce the frequency to say 10 seconds. This should not cause any measurable system perf degradation since its just 2 systems we are talking about.
I feel here, UDP is might be better compared to TCP. Its lightweight, does not consume a lot of system resources and is theoretically faster. Downside would be there could be packet loss. You can circumvent that by putting in some logic like when 10 packets (spaced 10 seconds apart) are not received consecutively  then declare the other system unreachable.
Python - Detect if remote computer is on