I want to generate UDP packet to test a program, something equivalent to using telnet to test TCP port (Can telnet generate UDP packet?)
How can I do this?
One word: Netcat
Netcat is the go-to tool for this sort of thing.
You can thrash whatever port you choose with UDP packets with something like:
(53 is your port number)
Or you can send an actual file, or tell it to bind that port and listen as a service, or whatever you like.
If you want to merely send one UDP packet with some specified data, as opposed to Satanicpuppy's answer which continuously sends random data, you can do:
This one is good if you are trying to work with large packets. netcat uses 1024 bytes in UDP mode.
UDP mode, to port 2090 at address, with a packet length of 1550 bytes.
This is from the nmap package, or is sometimes packaged as nping separately.
Further info is at https://nmap.org/book/nping-man-general-operation.html