I'm trying to create some DHCP software. I need to know how the DHCP protocol works.

I'm looking around for some code that will teach me how to make a DHCP Server program listen for DHCP requests, analyze them, then broadcast the IP address that gets assigned to the MAC address.

If someone already has code that does this it would be great . But other resources are fine too.

I Intend to use VB.Net/VB6 as the language, but would also settle for C++. But really any code would be useful.