Main Site Documentation

Anyone modified the Ethernet code to use DHCP?


#1

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…


#2

WIZnet have DHCP document show how to implement DHCP
http://www.wiznet.co.kr/UpLoad_Files/ReferenceFiles/W5100_Appnote_DHCP.zip


#3

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


#4

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:


#5

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


#6

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


#7

[quote]Not the same.

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

OK, it was worth a try :wink:


#8

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.


#9

Link:

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

Might help you get started
:wink: