Found one on this URL:
http://www.research.att.com/lists/uw.../msg00067.html
there are many examples like this , just do a simple search...
the main difference is using SOCK_DGRAM instead of SOCK_STREAM on the socket definition.. and of course you should be aware it's connectionless oriented protocol..
useful for broadcasts for example or reliable lines.
Hezki