Core Concepts

UDP is a connectionless protocol. Unlike making a phone call (TCP), it’s more like sending a postcard (UDP). You send it, but by default, you don’t receive any acknowledgment. Therefore, the most reliable way to test a UDP port is to: run a listening service on the target port, then send a “postcard” (data) from the outside, and confirm that the listening service has indeed received it.


Preparation

  • Server: The device that needs to receive data, which we’ll call Machine A.

  • Client: The device used to send data, which we’ll call Machine B.

  • Tools: Ensure that netcat (nc) is installed on both devices.


Operation Steps

Step 1: Start the listening service on the server (machine A)

nc -ulv -k  -p 41643

Parameter Explain:

  • -u: Specifies the use of the UDP protocol.

  • -l: Indicates Listen mode, running as a server.

  • -v: Verbose mode, displays more detailed connection information.

  • -k: Keep-open, this is a core option. It allows nc to continue listening after completing a communication, and can receive communication data from multiple clients or multiple communications from the same client.


Step 2: Send test data on the client (Machine B)

echo "This is a UDP test message." | nc -u -w 1 192.168.153.220 41643

Parameter Explain

  • -u:Similarly, it specifies the use of the UDP protocol.
  • -w 1:Set the timeout to 1 second. After sending data, nc will wait 1 second before exiting. This helps ensure that data packets have enough time to be sent.


Alternatively, interaction mode:

nc -uv  192.168.153.220 41643

Now you can begin testing: Type any text (e.g., hello) into the terminal on Machine B, and press Enter. Observe the terminal on Machine A; it should immediately display hello. You can continue to type more messages into Machine B, and Machine A will continuously receive and display them.


Note: The server must use the -k option. Otherwise, once the first client connects and sends data, the listening service will automatically exit, causing subsequent tests (whether from a new terminal or a new device) to fail.

Last modified: April 13, 2026

Comments

Write a Reply or Comment

Your email address will not be published.

The maximum upload file size: 80 MB. You can upload: image, audio, video, document, spreadsheet, interactive, text, archive, code, other. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop files here