Hello,
I have a project where I may need to change the network settings for my Arduino Ethernet Rev3 w/o PoE from a client. The Arduino loads the IP, DNS, Subnet, and Gateway from the EEPROM. Each of those has 4 bytes in the EEPROM associated with it (0-3, 4-7, 8-11, 12-15). The client sends it an IP, DNS, Subnet, or Gateway to the Arduino and the Arduino then saves that data in the EEPROM. I've wrote all this code already.
/*********************************************************************************
** EEPROM
*********************************************************************************/
case 0x35: // writeEEPROM_IP
EEPROM.write(0,command[2]); // first byte of IP
EEPROM.write(1,command[3]); // second byte of IP
EEPROM.write(2,command[4]); // third byte of IP
EEPROM.write(3,command[5]); // fourth byte of IP
Serial.println(Ethernet.localIP());
client.write('0');
break;
case 0x36: // writeEEPROM_DNS
EEPROM.write(4,command[2]); // first byte of DNS
EEPROM.write(5,command[3]); // second byte of DNS
EEPROM.write(6,command[4]); // third byte of DNS
EEPROM.write(7,command[5]); // fourth byte of DNS
client.write('0');
break;
case 0x37: // writeEEPROM_Gateway
EEPROM.write(8,command[2]); // first byte of gateway
EEPROM.write(9,command[3]); // second byte of gateway
EEPROM.write(10,command[4]); // third byte of gateway
EEPROM.write(11,command[5]); // fourth byte of gateway
client.write('0');
break;
case 0x38: // writeEEPROM_subnet
EEPROM.write(12,command[2]); // first byte of subnet
EEPROM.write(13,command[3]); // second byte of subnet
EEPROM.write(14,command[4]); // third byte of subnet
EEPROM.write(15,command[5]); // fourth byte of subnet
client.write('0');
break;]
What I need help on is actually updating my server. I've searched around a lot for "restarting" server, "stopping" server, and "update" server on the Arduino.cc forums, but those searches result in fixing problems with servers that are fickle and don't give a constant connection. What I'm looking for is something that will stop my Arduino server, update the settings, and start a new server.
My server is called "server" and I know "server.begin();" starts the server, and I believe "server.stop()" would stop it, but I have not found any documentation to support that from the Arduino Reference page. Ethernet - Arduino Reference
Any suggestions?
Thanks,
Matt