A simple yet powerful network monitoring tool to track packet loss and response time by pinging Google DNS server.
Since getting a new ISP, I noticed frequent drops when WiFi calling, such as through MS Teams and Messenger, and also while streaming games via Xbox Game Pass. I created this tool to alert me when high latency or major packet loss was expected so that I could pause my game before the connection drop could ruin my progress.
Connection Tester continuously monitors your internet connection by pinging Google's DNS server (8.8.8.8) at regular intervals. It detects and alerts you about network issues such as:
- Packet loss
- High latency spikes
- Unstable connections
The tool is especially useful for:
- Troubleshooting intermittent connection problems
- Detecting network degradation
- Monitoring connection quality during online gaming or video calls
- Real-time packet loss and response time monitoring
- Visual graph display of network metrics (optional)
- Audio alerts for high latency spikes
- CSV data export for further analysis
- Automatic baseline calculation to identify unusual latency
- Configurable thresholds and settings
- Python 3.6+
- Required packages:
- matplotlib
- numpy
- Clone the repository or download the source code
- Install the required packages:
pip install matplotlib numpy
Run the script using Python:
python main.py
The tool will start monitoring your connection to Google's DNS server and display the results in the console. By default, it will:
- Play alert sounds when high latency is detected
- Save results to a CSV file
- Not display the graph (to conserve resources)
You can modify the following variables at the top of the script:
# Global configuration variables
PING_PACKET_COUNT: int = 1 # Number of packets to send in each ping
PING_TIMEOUT_SECONDS: float = 10.0 # Timeout for ping operation
SLEEP_TIMER: float = 1.0 # Sleep time between pings
HIGH_LATENCY_THRESHOLD: float = 1.5 # Warning threshold: current latency > average * threshold
HISTORY_SIZE: int = 50 # Number of recent values to use for baseline average calculation
# Control variables
PLAY_ALERT_SOUND: bool = True # Whether to play sound on high latency
DISPLAY_PLOT: bool = False # Whether to display the plot
SAVE_CSV: bool = True # Whether to save results to CSV file
CSV_OUTPUT_DIR: str = os.path.join(os.path.dirname(os.path.abspath(__file__)), "Metrics") ## Where to save the metric csv files
The tool provides:
- Real-time console output showing packet loss and response time
- Audio alerts when high latency is detected
- CSV files with detailed data (if enabled)
- Interactive graph display (if enabled)
Press Ctrl+C
to stop the monitoring. The tool will display a summary of the session and save the results if CSV saving is enabled.
(Not so) Proudly vibe-coded using GitHub Copilot with Claude 3.7 Sonnet.