tcpie v11.0.0
tcpie
Ping any TCP port
tcpie is a tool to measure latency and verify the reliabilty of a TCP connection. It does so by initiating a handshake followed by an immediately termination of the socket. While many existing tools require raw socket access, tcpie runs fine in user space. An API for use as a module is also provided.
CLI
Installation
$ npm i -g tcpieExample
$ tcpie -c 5 google.com 443
TCPIE google.com (188.21.9.120) port 443
connected to google.com:443 seq=1 srcport=59053 time=12.9 ms
connected to google.com:443 seq=2 srcport=59054 time=10.0 ms
connected to google.com:443 seq=3 srcport=59055 time=10.1 ms
connected to google.com:443 seq=4 srcport=59056 time=11.4 ms
connected to google.com:443 seq=5 srcport=59057 time=10.4 ms
--- google.com tcpie statistics ---
5 handshakes attempted, 5 succeeded, 0% failed
rtt min/avg/max/stdev = 10.012/10.970/12.854/1.190 msAPI
Usage
import {tcpie} from "tcpie";
const pie = tcpie("google.com", 443, {count: 10, interval: 500, timeout: 2000});
pie.on("connect", function(stats) {
console.info("connect", stats);
}).on("error", function(err, stats) {
console.error(err, stats);
}).on("timeout", function(stats) {
console.info("timeout", stats);
}).on("end", function(stats) {
console.info(stats);
// -> {
// -> sent: 10,
// -> success: 10,
// -> failed: 0,
// -> target: { host: "google.com", port: 443 }
// -> }
}).start();tcpie(host, port, options)
hoststring : the destination host name or IP address. Required.portnumber : the destination port. Default:22.optsobject : options for count, interval and timeout. Defaults:Infinity,1000,3000.
tcpie#start()
Start connecting
tcpie#stop()
Stops connecting
options object
countnumber : the number of connection attempts in milliseconds (default: Infinity).intervalnumber : the interval between connection attempts in milliseconds (default: 1000).timeoutnumber : the connection timeout in milliseconds (default: 3000).
Events
connect: Arguments:stats. Connection attempt succeeded.timeout: Arguments:stats. Connection attempt ran into the timeout.error: Arguments:err,stats. Connection attempt failed.end: Arguments:stats. All connection attempts have finished.
stats argument properties
sentnumber : number of total attempts made.successnumber : number of successfull attempts.failednumber : number of failed attempts.targetobject : target details:hostandport.
The following properties are present on all events except end:
rttnumber : roundtrip time in milliseconds. undefined if failed.socketobject : socket details:localAddress,localPort,remoteAddress,remotePort.
© silverwind, distributed under BSD licence
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
5 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago