You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

tcpp

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tcpp

A Python implementation of TCP ping that tests connectivity to a remote host

1.0.1
pipPyPI
Maintainers
1

tcpp

A Python implementation of TCP ping that tests connectivity to a remote host by attempting TCP connections. It measures connection establishment times and provides detailed statistics.

Features

  • 🚀 Pure Python implementation, no external dependencies
  • 📦 Lightweight and easy to use
  • 🌐 Supports both IPv4 and IPv6
  • 🔄 Supports continuous ping mode

Installation

You can install tcpp directly from PyPI:

pip install tcpp

Usage

Command Line

Basic usage:

tcpp bing.com

With custom port and count:

tcpp bing.com 443 -c 10

All available options:

tcpp [-h] [-c COUNT] [-t TIMEOUT] [-4] [-6] [-v] host [port]

positional arguments:
  host                  Target hostname or IP address to ping
  port                  Target port number (default: 80)

options:
  -h, --help           Show this help message and exit
  -c, --count COUNT    Number of pings to send (default: 10, 0 = infinite)
  -t, --timeout SEC    Connection timeout in seconds (default: 1.0)
  -4                   Force using IPv4
  -6                   Force using IPv6
  -v, --version        Show program version

Python API

You can also use tcpp as a Python library:

import tcpp

# Basic usage
stats = tcpp.ping("bing.com", port=80)

# Access statistics
print(f"Success rate: {stats.success_rate}%")
print(f"Average time: {stats.avg_time:.2f}ms")

bing Output

TCPING bing.com (13.107.21.200)[:80]
Connected to bing.com[:80]: seq=1 time=61.64 ms
Connected to bing.com[:80]: seq=2 time=61.39 ms
Connected to bing.com[:80]: seq=3 time=59.84 ms
Connected to bing.com[:80]: seq=4 time=59.29 ms

--- bing.com[:80] tcping statistics ---
4 connections, 4 successed, 0 failed, 100.00% success rate
min = 59.29ms, max = 61.64ms, avg = 60.54ms, med = 60.62ms, mdev = 1.00ms

Requirements

  • Python 3.7 or higher
  • No external dependencies

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Keywords

tcp

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts