I'm going to give you a few suggestions into this dirty, dirty world of network programming.
Read: read the rfc for all the protocols that you want to know about. UDP's rfc number is 768
http://www.faqs.org/rfcs/rfc768.htm.
Learn how to make a packet header or design your own and take it from there.
Debugging isn't too hard if you sniff your packets with ethereal--it has a very intutive interface.
It might be sacrilege but also look at winsocks in addition to just raw sockets, they have some clever libraries.