https://github.com/pdrb/tcping
Ping hosts using tcp packets
https://github.com/pdrb/tcping
Last synced: 11 months ago
JSON representation
Ping hosts using tcp packets
- Host: GitHub
- URL: https://github.com/pdrb/tcping
- Owner: pdrb
- License: mit
- Created: 2019-09-24T21:52:53.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-27T03:00:24.000Z (over 6 years ago)
- Last Synced: 2025-05-31T11:44:05.983Z (about 1 year ago)
- Language: Nim
- Size: 8.79 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
tcping
=======
Ping hosts using tcp packets.
A Python version is `also available `_.
Simple example::
$ tcping example.org
Pinging example.org 4 times on port 80:
Reply from 93.184.216.34:80 time=1.72 ms
Reply from 93.184.216.34:80 time=1.81 ms
Reply from 93.184.216.34:80 time=1.75 ms
Reply from 93.184.216.34:80 time=1.77 ms
Statistics:
--------------------------
Host: example.org
Sent: 4 packets
Received: 4 packets
Lost: 0 packets (0.00%)
Min latency: 1.72 ms
Max latency: 1.81 ms
Average latency: 1.76 ms
Install
=======
**Using nimble**::
$ nimble install tcping
On Linux, a link to the resulting binary will be usually created at: "~/.nimble/bin/tcping".
To enable it "system wide" just copy the binary to "/usr/local/bin"::
$ cp ~/.nimble/bin/tcping /usr/local/bin
**Using nim compiler**:
Since only the standard library is used, just download the single source code
file and compile it::
$ wget https://raw.githubusercontent.com/pdrb/tcping/master/src/tcping.nim
$ nim c -d:release tcping.nim
**Using compiler to create a size optimized binary**::
$ nim c -d:release --opt:size --passL:-s tcping.nim
We can reduce the binary size even more using `UPX `_::
$ upx --best tcping
After these steps, the resulting binary size is 35K on my Linux server.
Usage
=====
::
Usage: tcping host [options]
ping hosts using tcp packets, e.g., 'tcping example.org'
Options:
-v, --version show program's version number and exit
-h, --help show this help message and exit
-t ping host until stopped with 'control-c'
-n:count number of requests to send (default: 4)
-p:port port number to use (default: 80)
-w:timeout timeout in milliseconds to wait for reply
(default: 3000)
Examples
========
Ping host on port 80 (default)::
$ tcping host
Ping host on port 22::
$ tcping host -p:22
Ping host 10 times with 1 second timeout::
$ tcping host -n:10 -w:1000