Anyone modified the Ethernet code to use DHCP?

Just thought I’d ask if anyone has looked at putting DHCP into the beta driver for the WIZ5100 code? I dislike hardcoding things when DHCP is there to make that unnecesary…

WIZnet have DHCP document show how to implement DHCP

(still hoping someone’s done the lifting for me :wink: )

Chris has used DHCP in his NTPclock program
(link removed)
Anyway, the day before yesterday he provided me this code to enable DHCP:


using Microsoft.SPOT.Net.NetworkInformation;


NetworkInterface[] netif = NetworkInterface.GetAllNetworkInterfaces();
            // Get an IP address from DHCP server
            if (netif[0].IsDhcpEnabled)
            {
                netif[0].RenewDhcpLease();
            }
            else
            {
                netif[0].EnableDhcp();
            }

I do not know if this is what you’re asking, but it might do the trick :wink:

Not the same. :wink:

This code is for the internal Ethernet controller.

The W5100 controller from Wiznet is an external controller with SPI interface and it seems DHCP is not natively implemented.

So you have to write your own code to support DHCP

yeah just a few more lines of code to write :slight_smile: Priorities though means DHCP = Later :wink:

[quote]Not the same.

This code is for the internal Ethernet controller.
[/quote]

OK, it was worth a try :wink:

Sooner or later, GHI did say they were going to add support for the ethernet shield Nativity. Then, that code that I gave Robert wlll work.

Until then, there is an already written Arduino DHCP and DNS library around if you want to port it yourself.

I don’t have much interest in working on much of this, since, like I said, GHI is going to do it officially later.

Link:

http://blog.jordanterrell.com/post/Arduino-DHCP-Library-Version-03.aspx

Might help you get started
:wink: