# react-native-tcpping

> A ping utility using TCP connection

Latest version **0.0.3** (published 2021-02-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-tcpping
pnpm add react-native-tcpping
yarn add react-native-tcpping
bun add react-native-tcpping
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2021-02-22 |
| First published | 2021-02-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 12.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | wlfcss |
| Maintainers | wlfcss |
| Keywords | ping, util, tcp, availability |

## Links

- npm: https://www.npmjs.com/package/react-native-tcpping
- npm.io page: https://npm.io/package/react-native-tcpping

## Dependencies (2)

- [browser-process-hrtime](https://npm.io/package/browser-process-hrtime.md) ^0.1.2
- [react-native-tcp-socket](https://npm.io/package/react-native-tcp-socket.md) ^4.5.5

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2021-02-22
- 0.0.2 — 2021-02-22
- 0.0.1 — 2021-02-22

## README

react-native-tcpping
========

TCP ping utility for node.js. You can test if chosen address accepts connections at desired port and find out your latency. Great for service availability testing.

#####Why not ```ping``` wrapper?

* It's much faster than ```ping``` tool (as soon as connection gets accepted, it's dropped and a new measure is conducted immediately), so there's no unnecessary waiting between requests.
* It allows you to test a specific service, not the whole connection
* Some servers drop ICMP echo without any response, even when online. TCP can work in such cases.

###Install

```
npm install tcp-ping
```

###Functions

#####ping(options)

```options``` is an object, which may contain several properties:

* address (address to ping; defaults to ```localhost```)
* port (defaults to ```80```)
* timeout (in ms; defaults to 5s)
* attempts (how many times to measure time; defaults to 10)

Returns a promise that resolves with an object which looks like this:
```javascript
{
  address: '46.28.246.123',
  port: 80,
  attempts: 10,
  avg: 19.7848844,
  max: 35.306233,
  min: 16.526067,
  results:
   [
    { seq: 0, time: 35.306233 },
    { seq: 1, time: 16.585919 },
    ...
    { seq: 9, time: 17.625968 }
   ]
}
```

#####probe(address, port)

###Usage

```javascript
var tcpp = require('react-native-tcpping');

const available = await tcpp.probe('46.28.246.123', 80)

const data = await tcpp.ping({ address: '46.28.246.123' })
```

---
_Source: https://npm.io/package/react-native-tcpping · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
