Increasing the Robustness of UDP Applications

Because UDP is unreliable, problems arise when you least expect them. Although the echo client of Figure 18.5 looks simple, it actually contains a hidden bug. To bring out this bug, try pointing the client at an echo server running on a remote UNIX host somewhere on the Internet. Instead of typing directly into the client, redirect its standard input from a large text file, such as /usr/dict/words:

% udp_echo_cli1.pl wuarchive.wustl.edu echo </usr/dict/words
					

If the quality of your connection is excellent, you may see the entire contents of the file scroll by and the command-line prompt reappear after the last line is echoed. More likely, though, you will see the program get part way through the ...

Get Network Programming with Perl now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.