Skip to content
ping with UDP packets πŸ› 
Branch: master
Clone or download

Latest commit

wangyu- Merge pull request #8 from gnattu/master
Resolve hostname before storing, fixes #2, fixes #6
Latest commit 12464c5 Sep 15, 2019


Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Initial commit May 18, 2018 add sys.stdout.flush() and fix typo May 3, 2019 Resolve hostname before storing, fixes #2, fixes #6 Aug 30, 2019


ping with UDP protocol πŸ› 

How it looks like

root@raspberrypi:~# ./ 4000
UDPping via port 4000 with 64 bytes of payload
Reply from seq=0 time=138.357 ms
Reply from seq=1 time=128.062 ms
Request timed out
Reply from seq=3 time=136.370 ms
Reply from seq=4 time=140.743 ms
Request timed out
Reply from seq=6 time=143.438 ms
Reply from seq=7 time=142.684 ms
Reply from seq=8 time=138.871 ms
Reply from seq=9 time=138.990 ms
--- ping statistics ---
10 packets transmitted, 8 received, 20.00% packet loss
rtt min/avg/max = 128.06/138.44/143.44 ms

Getting Started

Step 1

Set up a udp echo server at the host you want to ping.

There are many ways of doing this, my favourite way is:

socat -v UDP-LISTEN:4000,fork PIPE

Now a echo server is listening at port 4000.


If you dont have socat, use apt install socat or yum install socat, you will get it.

Step 2

Ping you server.

Assume is the IP of your server.

./ 4000


Now UDPping will generate outputs as a normal ping, but the protocol used is UDP instead of ICMP.

Advanced Usage

root@raspberrypi:~# ./
   this_program <dest_ip> <dest_port>
   this_program <dest_ip> <dest_port> "<options>" 

   LEN         the length of payload, unit:byte
   INTERVAL    the seconds waited between sending each packet, as well as the timeout for reply packet, unit: ms

   ./ 4000
   ./ 4000 "LEN=400;INTERVAL=2000"
   ./ fe80::5400:ff:aabb:ccdd 4000
You can’t perform that action at this time.