Introducing the Zing zero-packet network utility

Zing Me

© Photo by Johannes Plenio on Unsplash

© Photo by Johannes Plenio on Unsplash

Article from Issue 265/2022

Zing is a lightweight, zero-packet network utility similar to ping that provides ping functionality without the payload.

The ping networking utility (backronym Packet InterNet Groper) [1, 2, 3] is a common tool used to determine network delay and whether a host is active at an IP address [4]. Ping sends an Internet Control Message Packet (ICMP) [5] to a host as an echo request, which then receives a response from the remote host. Ping sends data about the time and the host sends the data back – to put it at its simplest, plainest explanation.

Ping is popular with admins around the world, however, the ping utility is not without problems. For instance, ping can be used to send a packet storm to overload and crash a host system – a denial-of-service (DOS) attack called a ping flood. Some sites simply do not respond to ping requests, and some firewalls block the ICMP packets sent by the ping utility.

A problem I faced was the need for ping functionality, but without sending packets of data through the network. One of the best things about being a software development engineer is that, for interesting problems, it only takes a little creativity to find a solution. Driven by the need, I created my own network utility.

My requirements for this utility were:

  • No data payload is sent or received, to avoid network congestion.
  • Ability to check that both a host and the ports are alive and available
  • Able to report the time to reach a host connect and disconnect
  • Available to run on multiple platforms, in this case, Windows, macOS, and Linux
  • Support for both Internet Protocol version 4 and version 6 addresses
  • Parameters and reporting similar to ping – a familiar look and feel

With these objectives in mind, I created Zing. The name Zing is an acronym for Zero packet pING. I wanted the utility to have a name that sounds like ping, but I also liked the reference to zinging a system, much as an improv comic will zing a person in humor.


Zing is implemented as both a command-line interface utility and a library function in Java. Using Java achieves cross-platform availability. Then, for each platform, I created a launch app (or kicker app) to run the Zing network utility.

Zing works by a simple approach: Measure the amount of time to connect and disconnect from specified ports for some limit to the number of operations. The idea behind Zing is not uniquely mine. I have read source code in network applications and libraries that takes a similar approach. Unlike the other tools I've seen, though, Zing is designed to look and operate more like ping.

This idea of connecting, binding, and disconnecting avoids sending any ICMP packets or other data. Zing simply requests to connect, connects, then disconnects. More measurements of each op give greater accuracy in the network timing. During this process, a host and port are determined to be reachable, available, and responding. Also, in some cases, a connection request can pass through a firewall to a remote host and port.

The host system will only see several connection requests, connects, and disconnects. In short, Zing looks like any other Internet application because it is not sending an ICMP packet.


Zing is implemented in Java and is a command line interface utility application. The Java class source code is approximately 400 lines, of which there are approximately 250 lines of code. Zing uses only JDK libraries and packages and implements some helpful internal methods. All methods and attributes are static, and the Java class does not sub-class a parent class explicitly (all Java classes are a sub-class of java.lang.Object implicitly), and Zing is a self-contained program utility using only the libraries in the JDK within the Java class.

The Zing network utility has the following command line parameters:

zing [-4 | -6] [-c count] [-op ops] flfl
[-p ports] [-t timeout] [-h] hostname

Each Zing network utility parameter is:

-4:  TCP IP address version 4 (IPv4)
-6:  TCP IP address version 6 (IPv6).
-c:  the count of the number of operations per port.
-op: the number of ops per count.
-p:  a list of ports to be used by the Zing network utility.
-t:  the timeout waiting for a host response.
-h:  a request for help, giving the Zing CLI parameters.

The hostname can be the host system IP address or the host system name. The default values for the command line interface parameters for the Zing network utility are:

zing -4 -c 4 -op 4 -p 80,443 -t 4000 host

These default command line interface parameters are Internet Protocol version 4 (IPv4), with a count of four times for each port, and the default ports are port 80 for the HTTP protocol and 443 for the HTTPS protocol. The default timeout is 4,000 milliseconds or four seconds. The host you wish to zing is a required parameter with no default.


The Zing network utility is a single Java class with static methods and attributes. The 12 static attributes are used by Zing and are initialized to the default values. The 10 static attributes as Java code fragments are (see Table 1 for descriptions):

boolean     hostFlag  = true;
boolean     tcp4Flag  = true;
InetAddress inet_addr = null;
int         count     = 4;
int         limit     = 4;
int         timeout   = 4000;
Integer[]   ports     = flfl
    new Integer[]{ 80, 443 };
String      host      = "localhost";
String      hostAddr  = "";
String      hostName  = "";

Table 1

Zing Attributes




indicates if the host is available and reachable. By default, a host is presumed to be available and reachable. Thus hostFlag is initialized to true.


indicates if the zing will use a host IP address of Internet Protocol version 4 (IPv4) or Internet Protocol version 6 (IPv6) for the domain name.


the Internet address retrieved from a query to the domain name system. Initially null because the Internet address must be queried to create an instance value of an Internet address.


the number of times the Zing network utility will zing a host. The default number is four times.


the number of times to perform an individual operation, a connect-disconnect to a port. The default limit is four operations. A higher limit is more accurate but requires a longer time to process.


the number of milliseconds to wait to reach a hostname. The default timeout is 4,000 milliseconds or four seconds.


the ports on the remote host to process. The two default ports are port 80, for HTTP, and port 443 for HTTPS – both ports are commonly used by hosts.


a string representing the IP address of the remote host. Initially, it is an empty, blank string.


passed to Zing and resolved both as an IP address and a hostname. Initially, the hostName is a string but initialized to an empty string.

The Zing network utility also has 10 specific static methods for the operation of the utility. The 10 methods are shown in Listing 1. See Table 2 for a description of these Zing methods.

Listing 1

Zing Methods

01 double          doZingToHost(final String host, final int port)
02 InetAddress  getHostAddrName(final String host)
03 Inet4Address     getIPv4Addr(final String hostName)
04 Inet6Address     getIPv6Addr(final String hostName)
05 double          getTotalTime(final double totalTime,
06                              final int portsLength, final int limit)
07 void main(final String[] args)
08 void processArgs(final String[] args)
09 void report(final double time)
10 void stddev(final double average, final double[] values)
11 void usage()

Table 2

Zing Methods




displays the proper usage and an example of command line interface parameters


a method called when the Zing network utility is run


used to process the command line parameters and configure the attributes


prints a summary of the statistics calculated by the Zing network utility


computes standard deviation [6] as part of the report after a computer system is zinged


returns the host name


returns the IPv4 address


returns the IPv6 address


returns a double, a real number for the time calculated to zing a host computer system on a network


the core method containing the actual functionality for the Zing utility

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Command Line: Network Diagnostic Tools

    Linux has the right tools to track down network errors and open the way for data packets.

  • Connecting to the world
  • OpenFlow

    The OpenFlow protocol and its surrounding technologies are bringing the promise of SDN to real networks – and it might not be long before you see them on your real network.

  • Pinger

    The Pinger network monitoring tool uses ping to look for switches and estimate cable lengths.

  • IPv6 Pen Testing

    If you have enabled IPv6 on your network without considering basic security issues, you might have opened up a hole for attackers. In this article, we demonstrate a successful attack on a server via IPv6 and explain how the popular security tools handle IPv6.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More