> ## Content Index
> Fetch the complete content index at: https://www.bagz.fr/llms.txt
> Use this file to discover other available public pages before exploring further.

# Send an UDP packet with NetCat
- URL: https://www.bagz.fr/send-an-udp-packet-with-netcat/
- Published: 2016-09-07T08:53:38.000Z
- Updated: 2016-09-07T08:53:38.000Z
- Author: bgazui
- Tags: Linux, #Migrated-1790668826633, #wp, #wp-post, #Import 2026-09-29 08:00

It can be needed to test an UDP connection with a server to ensure that connectivity is working and double check the data received.

Let's take a simple example with a remote logstash server:

- Server **mylogstash.mydomain.local**
- Listening on port **5000**

On emitter side, we are sending an UDP packet simulating a log line coming from an application:

echo -e '{"version": "1.1","host":"myapp.org","message":"My message","backtrace":"Backtrace of my app\\n\\nmore stuff"}\\0' | nc -u -w 1 mylogstash.mydomain.local 5000  

On receiving server side, we are executing a tcpdump to check that packet is correctly coming with good content:

\# tcpdump -i any udp port 5000 -A  
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode  
listening on any, link-type LINUX\_SLL (Linux cooked), capture size 262144 bytes  
10:43:47.621172 IP mylogstash.mydomain.local.49435 > localhost.5000: UDP, length 108  
E.....@.@............./..t..{"version": "1.1","host":"myapp.org","message":"My message","backtrace":"Backtrace of my app  
  
more stuff"}.  

Here we are! It's very simple to control UDP flows or simply check connection between 2 servers.