Skip to main content

Posts

Showing posts with the label network connection

Python script for Autoshutdown v2

This blog is an improvement to the script I mentioned in  Python Script for Autoshutdown . But soon after months to follow, my ISP has blocked pinging to internet, and since my logic was to try to ping Google servers; I had to alter my logic to use HTTP connection. I have changed the script to use HTTP instead of just pinging. This is my code in Python. As always, please feel free to suggest any improvement.

Python script for Autoshutdown v1

In the recent past, my interest for python grew to insurmountable proportion; mainly because of the ease and pseudo-code style syntax. I was actively using python for my Project Euler codes. I am an avid downloader mainly from torrents. Then one day i thought, wouldn't it be nicer if my PC could shutdown automatically when-ever my internet connection breaks up!!! My first choice was a DOS bat script. But then, who uses bat now a days.. :P So, I hooked on to python. It was a matter of a few hours before I could fix it! Here's my script - The same thing in DOS batch file - Feel free to post any improvements in this code of mine...