Sketches that don't need DNS (For reference, I'll refer to the examples included with nick gammon's HTTPServer Library here: https://github.com/nickgammon/HTTPserver) include a compiled copy of getHostByName() and (as far as I can tell) all associated DNS lookup code when it is completely unnecessary. (i.e. Never used, referenced, and a DNS Server never defined.)
Using #ifdef to remove EthernetUDP::beginPacket(const char, uint16_t) and EthernetClient::connect(const char, uint16_t), and associated templates in UDP.h and Client.h is sufficient to ensure that getHostByName, and associated DNS Code is not linked in to the sketch.
Using the Arduino IDE version 1.8.7, For the Process_POST_arguments example in the library linked above, Not linking in this unneeded code saves me 3508 bytes on my compiled sketch.
I'm not sure why these (completely unused) convenience functions are not being stripped by the linker, but they are not. I would be happy to help by testing patches, etc, but I don't know enough about the linker to be of much help.
For anyone writing a project with a Web-server, which doesn't use DNS, those extra bytes would make a big difference. (3500 bytes is 12% of the program space in a Arduino Leonardo, for example.)
I know fixing this may involve a API change, but having the DNS code there for projects that don't need it is a Huge waste of program space.
Sketches that don't need DNS (For reference, I'll refer to the examples included with nick gammon's HTTPServer Library here: https://github.com/nickgammon/HTTPserver) include a compiled copy of getHostByName() and (as far as I can tell) all associated DNS lookup code when it is completely unnecessary. (i.e. Never used, referenced, and a DNS Server never defined.)
Using #ifdef to remove EthernetUDP::beginPacket(const char, uint16_t) and EthernetClient::connect(const char, uint16_t), and associated templates in UDP.h and Client.h is sufficient to ensure that getHostByName, and associated DNS Code is not linked in to the sketch.
Using the Arduino IDE version 1.8.7, For the Process_POST_arguments example in the library linked above, Not linking in this unneeded code saves me 3508 bytes on my compiled sketch.
I'm not sure why these (completely unused) convenience functions are not being stripped by the linker, but they are not. I would be happy to help by testing patches, etc, but I don't know enough about the linker to be of much help.
For anyone writing a project with a Web-server, which doesn't use DNS, those extra bytes would make a big difference. (3500 bytes is 12% of the program space in a Arduino Leonardo, for example.)
I know fixing this may involve a API change, but having the DNS code there for projects that don't need it is a Huge waste of program space.
Thank you for all your work!