{"id":13583730,"url":"https://github.com/silverwind/tcpie","last_synced_at":"2025-04-14T03:12:40.443Z","repository":{"id":25268263,"uuid":"28693683","full_name":"silverwind/tcpie","owner":"silverwind","description":"CLI tool to ping any TCP port","archived":false,"fork":false,"pushed_at":"2025-02-14T17:36:06.000Z","size":649,"stargazers_count":53,"open_issues_count":4,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T03:12:32.633Z","etag":null,"topics":["cli","network-test","nodejs","port-scanner","port-test"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/silverwind.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-01-01T19:25:55.000Z","updated_at":"2025-02-14T17:36:10.000Z","dependencies_parsed_at":"2024-06-19T00:28:30.603Z","dependency_job_id":null,"html_url":"https://github.com/silverwind/tcpie","commit_stats":null,"previous_names":[],"tags_count":69,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silverwind%2Ftcpie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silverwind%2Ftcpie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silverwind%2Ftcpie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silverwind%2Ftcpie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/silverwind","download_url":"https://codeload.github.com/silverwind/tcpie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248813799,"owners_count":21165634,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","network-test","nodejs","port-scanner","port-test"],"created_at":"2024-08-01T15:03:44.289Z","updated_at":"2025-04-14T03:12:40.424Z","avatar_url":"https://github.com/silverwind.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Fingerprint"],"sub_categories":["Network map"],"readme":"# tcpie\n[![](https://img.shields.io/npm/v/tcpie.svg?style=flat)](https://www.npmjs.org/package/tcpie) [![](https://img.shields.io/npm/dm/tcpie.svg)](https://www.npmjs.org/package/tcpie) [![](https://img.shields.io/bundlephobia/minzip/tcpie.svg)](https://bundlephobia.com/package/tcpie) [![](https://packagephobia.com/badge?p=tcpie)](https://packagephobia.com/result?p=tcpie)\n\n\u003e Ping any TCP port\n\ntcpie 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.\n\n## CLI\n\n### Installation\n```\n$ npm i -g tcpie\n```\n### Example\n```\n$ tcpie -c 5 google.com 443\nTCPIE google.com (188.21.9.120) port 443\nconnected to google.com:443 seq=1 srcport=59053 time=12.9 ms\nconnected to google.com:443 seq=2 srcport=59054 time=10.0 ms\nconnected to google.com:443 seq=3 srcport=59055 time=10.1 ms\nconnected to google.com:443 seq=4 srcport=59056 time=11.4 ms\nconnected to google.com:443 seq=5 srcport=59057 time=10.4 ms\n\n--- google.com tcpie statistics ---\n5 handshakes attempted, 5 succeeded, 0% failed\nrtt min/avg/max/stdev = 10.012/10.970/12.854/1.190 ms\n```\n\n## API\n\n### Usage\n```js\nimport {tcpie} from \"tcpie\";\nconst pie = tcpie(\"google.com\", 443, {count: 10, interval: 500, timeout: 2000});\n\npie.on(\"connect\", function(stats) {\n  console.info(\"connect\", stats);\n}).on(\"error\", function(err, stats) {\n  console.error(err, stats);\n}).on(\"timeout\", function(stats) {\n  console.info(\"timeout\", stats);\n}).on(\"end\", function(stats) {\n  console.info(stats);\n  // -\u003e {\n  // -\u003e   sent: 10,\n  // -\u003e   success: 10,\n  // -\u003e   failed: 0,\n  // -\u003e   target: { host: \"google.com\", port: 443 }\n  // -\u003e }\n}).start();\n```\n#### tcpie(host, [port], [options])\n- `host` *string* : the destination host name or IP address. Required.\n- `port` *number* : the destination port. Default: `22`.\n- `opts` *object* : options for count, interval and timeout. Defaults: `Infinity`, `1000`, `3000`.\n\n#### tcpie#start()\nStart connecting\n\n#### tcpie#stop()\nStops connecting\n\n#### *options* object\n- `count`    *number* : the number of connection attempts in milliseconds (default: Infinity).\n- `interval` *number* : the interval between connection attempts in milliseconds (default: 1000).\n- `timeout`  *number* : the connection timeout in milliseconds (default: 3000).\n\n#### Events\n- `connect` : Arguments: `stats`. Connection attempt succeeded.\n- `timeout` : Arguments: `stats`. Connection attempt ran into the timeout.\n- `error`   : Arguments: `err`, `stats`. Connection attempt failed.\n- `end`     : Arguments: `stats`. All connection attempts have finished.\n\n#### *stats* argument properties\n- `sent`    *number* : number of total attempts made.\n- `success` *number* : number of successfull attempts.\n- `failed`  *number* : number of failed attempts.\n- `target`  *object* : target details: `host` and `port`.\n\nThe following properties are present on all events except `end`:\n- `rtt`     *number* : roundtrip time in milliseconds. *undefined* if failed.\n- `socket`  *object* : socket details: `localAddress`, `localPort`, `remoteAddress`, `remotePort`.\n\n© [silverwind](https://github.com/silverwind), distributed under BSD licence\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilverwind%2Ftcpie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsilverwind%2Ftcpie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilverwind%2Ftcpie/lists"}