jnb-ping

Java Non-Blocking Ping (ICMP)

License

License

GroupId

GroupId

com.zaxxer
ArtifactId

ArtifactId

jnb-ping
Last Version

Last Version

1.3.2
Release Date

Release Date

Type

Type

jar
Description

Description

jnb-ping
Java Non-Blocking Ping (ICMP)
Project URL

Project URL

https://github.com/brettwooldridge/jnb-ping
Source Code Management

Source Code Management

https://github.com/brettwooldridge/jnb-ping

Download jnb-ping

How to add to project

<!-- https://jarcasting.com/artifacts/com.zaxxer/jnb-ping/ -->
<dependency>
    <groupId>com.zaxxer</groupId>
    <artifactId>jnb-ping</artifactId>
    <version>1.3.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.zaxxer/jnb-ping/
implementation 'com.zaxxer:jnb-ping:1.3.2'
// https://jarcasting.com/artifacts/com.zaxxer/jnb-ping/
implementation ("com.zaxxer:jnb-ping:1.3.2")
'com.zaxxer:jnb-ping:jar:1.3.2'
<dependency org="com.zaxxer" name="jnb-ping" rev="1.3.2">
  <artifact name="jnb-ping" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.zaxxer', module='jnb-ping', version='1.3.2')
)
libraryDependencies += "com.zaxxer" % "jnb-ping" % "1.3.2"
[com.zaxxer/jnb-ping "1.3.2"]

Dependencies

compile (4)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-reflect jar 1.3.70
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.3.70
com.github.jnr : jnr-posix jar 3.0.52
it.unimi.dsi : fastutil jar 8.1.0

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

jnb-ping - Java Non-Blocking ICMP Ping

A non-blocking ICMP library for Java, using JNA to access native APIs, supporting thousands of simultaneous ICMP ping targets. Written in Kotlin, but compatible with Java (or any JVM-hosted language).

Currently, only Linux and MacOS X are supported.

Example:

class PingHandler : PingResponseHandler {
   override fun onResponse(pingTarget: PingTarget, responseTimeSec: Double, byteCount: Int, seq: Int) {
      System.out.printf("  ${Thread.currentThread()} $byteCount bytes from $pingTarget: icmp_seq=$seq time=%1.6f\n", responseTimeSec)
   }

   override fun onTimeout(pingTarget: PingTarget) {
      System.out.println("  ${Thread.currentThread()} Timeout $pingTarget")
   }
}

val pinger = IcmpPinger(PingHandler())
pinger.ping( PingTarget(InetAddress.getByName("8.8.8.8")) )
pinger.ping( PingTarget(InetAddress.getByName("youtube.com")) )

while (pinger.isPendingWork()) Thread.sleep(500)

pinger.stopSelector()

The minimum supported Linux kernel version is v4.19.10. It may work with older kernels (some reported working on v3.13.), depending on the kernel configuration parameters, but only v4.19.10+ has been tested. I am fairly certain that IPv6 is not supported (by this library) on any Linux kernel version less than v4.19.

Versions

Version
1.3.2
1.3.1
1.3.0
1.2.0
1.1.0
1.0.0
0.9.4
0.9.3
0.9.2
0.9.1