Skip to main content

This python module provides an asynchroneous version of ping. It is based on the trio framework.

Project description

jk_trioping

Introduction

This python module provides an asynchroneous version of ping. It is based on the trio framework.

Information about this module can be found here:

Why this module?

It is not too difficult to perform a ping to multiple hosts in parallel. Suprisingly modules, examples or even binaries to do exactly that are hard to find. This modules now offers a simple solution to that problem.

How to use this module

Import this module

Please include this module into your application using the following code:

import trio
import jk_trioping

Perform single ping

async def main(hostAddress):
	ret = await jk_trioping.ping(
		host = hostAddress,
		timeout = 2,
		repeats = 1
	)
	print(ret)

trio.run(main, "127.0.0.1")

This will perform a single ping to a single host. The result will look something like this:

0.063

Perform multiple pings

async def main(hostAddresses):
	ret = await jk_trioping.multiPing(
		hosts = hostAddresses,
		timeout = 2,
		repeats = 1
	)
	print(ret)

trio.run(main, [ "127.0.0.1", "localhost" ])

This will perform a ping to two hosts (addressing one by IP address, one by name) and print something like this:

{'localhost': 0.071, '127.0.0.1': 0.073}

Contact Information

This is Open Source code. That not only gives you the possibility of freely using this code it also allows you to contribute. Feel free to contact the author(s) of this software listed below, either for comments, collaboration requests, suggestions for improvement or reporting bugs:

License

This software is provided under the following license:

  • Apache Software License 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jk_trioping-0.2020.4.1.tar.gz (8.1 kB view details)

Uploaded Source

File details

Details for the file jk_trioping-0.2020.4.1.tar.gz.

File metadata

  • Download URL: jk_trioping-0.2020.4.1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.2

File hashes

Hashes for jk_trioping-0.2020.4.1.tar.gz
Algorithm Hash digest
SHA256 e931dd7c825c6a5c8ef852259db3fdff48a22151bffbb68c06126cd6fcfc936d
MD5 57178d695ee3a9b3ecab98d537112a21
BLAKE2b-256 1acda88a9f75098b03f4fd494127b7468b693683b9e783bc4bec154a19831a7e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page