if you haven't yet heard of it, a utility called netcat is very useful for debugging network applications. it's small and easy to use from command line, able to do either side of connection etc.
regards a comment that UDP is peerless..i doubt whether this is true. afaik it still makes a connection directly to destination, but the protocol does not guarantee delivery or correct ordering of packets such as provided by TCP. UDP is not broadcast...unless you use a broadcast destination address. all IP traffic has source and destination address and port pairs.
the hardest line to type correctly is: stty erase ^H