I´d like to connect my Ethernet2 with WIZ550 using DHCP but instead of Local IP, I want to use Hostname.
This is my code, it works. I get a Local IP Address and I can connect to Arduino using this IP, but I don't know how to setup hostname.
void setup() {
// Monitor Serial begin
Serial.begin(9600);
Serial.println("Welcome to Itronic");
// start the Ethernet connection:
#if defined(WIZ550io_WITH_MACADDRESS)
if (Ethernet.begin() == 0) {
#else
if (Ethernet.begin(mac) == 0) {
#endif
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
for (;;)
;
}
// print your local IP address:
Serial.print("My IP address: ");
for (byte thisByte = 0; thisByte < 4; thisByte++) {
// print the value of each byte of the IP address:
Serial.print(Ethernet.localIP()[thisByte], DEC);
Serial.print(".");
}
Serial.print("My MacAddress: ");
for (byte thisByte = 0; thisByte < 6; thisByte++) {
// print the value of each byte of the IP address:
Serial.print(mac[thisByte], HEX);
Serial.print(",");
}
Serial.println();
server.begin();
// Hardware Serial (2,3) begin
mySerial.begin(19200);
Serial.print("hostName: ");
Serial.print(Ethernet.hostName());
Serial.print("dnsDomainName: ");
Serial.print(Ethernet.dnsDomainName());
IRreceiver.enableIRIn(); // Start the receiver
}