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.

Files for jk-trioping, version 0.2020.4.1
Filename, size File type Python version Upload date Hashes
Filename, size jk_trioping-0.2020.4.1.tar.gz (8.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page