Add getopt() to udp client and add some comments.

Let me know if you feel strongly about any of the changes and I'll revert it.

(Sorry for the git drama. I am still new :-))