0

Is there any way to get a specific dhcp option using Arduino and ethernet? I am trying to spare the pins that would be used as a setup, so i send the configuration to the arduino via lan. I would like to be able to specify where the arduino will receive the configuration from. I was thinking of providing it with a configuration server through a dhcp option (option codes 224 through 255 are reserved for private use)

I cannot find any information on how to retrive specific dhcp options using ethercard.h and ENC28J60 board anywhere in the documentation.

Did anyone attempt (and succeed) in doing this?

thanks

Tomislav Plečko
  • 167
  • 2
  • 14

1 Answers1

0

After some extensive reading of the ethercard source, i came up with this:

Add ether.dhcpAddOptionCallback(246,DHCPOption); to void setup, and this void:

void DHCPOption(uint8_t option, const byte* data, uint8_t len) {
    Serial.println(option);
    Serial.println(len);
    for (int i = 0; i < len; i++) {
        Serial.println(data[i]);
    }
}
Tomislav Plečko
  • 167
  • 2
  • 14