ping: icmp echo requests

[ bsd3, library, network ] [ Propose Tags ]

This library provides functions that have similar behavior as the unix command-line utility ping. In particular, both emit ICMP echo requests and wait for responses. This library uses a haskell implementation of ICMP rather than invoking `binping`. This avoids the costly process of starting a child process. Additionally, there are greater opportunities for reusing sockets. The cost of this is that the user must ensure that one of these is true:

  • The kernel parameter net.ipv4.ping_group_range has been configured to allow pings to all IP addresses. (preferred solution)

  • The process is running with the the CAP_NET_RAW capability.

  • The process is running as root. (worst solution)

[Skip to Readme]


[Index] [Quick Jump]


Manual Flags


Print debug output


Build CLI application that exposes ping-like functions as subcommands


Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainer's Corner

For package maintainers and hackage trustees


Versions [RSS],,, (info)
Change log
Dependencies base (>=4.11.1 && <5), cpu (>=0.1.2), ip (>=1.5), optparse-applicative (>= && <0.15), ping, posix-api (>=0.3 && <0.4), primitive (>=0.7 && <0.8), primitive-addr (>=0.1 && <0.2), primitive-containers (>=0.3.1), stm (>=2.5), text (>=, transformers (>=0.5.5) [details]
License BSD-3-Clause
Copyright 2019 Andrew Martin
Author Andrew Martin
Category Network
Home page
Uploaded by andrewthad at 2019-07-22T15:20:00Z
Distributions NixOS:
Executables multiping
Downloads 1501 total (4 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2019-07-22 [all 1 reports]

Readme for ping-

[back to package description]



This library provides high-performance functions that issue ICMP echo requests and wait for responses, measuring the elapsed time. It is intended to be cross-platform as possible, and it may use any system APIs available. However, it will not resort to running /bin/ping as a subprocess. Pull requests that improve compatibility will accepted so long as they do not start a subprocess.

Build Instructions

This library relies on posix-api, which needs a currently-unreleased version of hsc2hs in order to build. In order to try out this library, try:

~/dev $ git clone
~/dev $ cd hsc2hs
~/dev/hsc2hs $ cabal install
~/dev/hsc2hs $ cd ..
~/dev $ git clone
~/dev $ cd ping
~/dev/ping $ cabal new-build --with-hsc2hs=~/.cabal/bin/hsc2hs

This will build all dependencies, including posix-api, with the upstream hsc2hs tool.


This project's objective is to be cross-platform. However, it does not accomplish this. The author primarily runs a Debian Linux distribution and consequently lacks the resources and the motivation to make this work on other platforms. Contributions to improve compatibility are welcomed. Current known problems include:

  • On Linux, the library should fallback to using raw sockets if IPPROTO_ICMP does not work.
  • Support for Windows is missing.
  • Support for BSD is missing. However, adding raw socket support to improve the situation on Linux may fix this as well.
  • Support for Darwin is missing. This should not be difficult since Darwin supports IPPROTO_ICMP sockets.