Ethernet icon indicating copy to clipboard operation
Ethernet copied to clipboard

Ethernet.setHostname added (hostname to send with DHCP request)

Open JAndrassy opened this issue 1 year ago • 1 comments

There is already a PR for setHostname to set the hostname sent with the DHCP request and some older PR which don't use the setHostname() setter.

I provide my approach which doesn't store the hostname internally to save memory. I added the same code to my EthernetENC library. If setHostname is not used from the sketch the old code with the default hostname is executed.

overview of WiFi/Ethernet getters and setters: https://github.com/JAndrassy/Arduino-Networking-API/blob/main/ArduinoNetAPILibs.md#network-interface-getters-and-setters

JAndrassy avatar Oct 07 '23 11:10 JAndrassy

Memory usage change @ 294063ec3e8fa4eee6499310bc7e20903cdd730d

Board flash % RAM for global variables %
arduino:avr:leonardo :grey_question: -98 - +646 -0.34 - +2.25 :green_heart: -102 - 0 -3.98 - 0.0
arduino:avr:mega :grey_question: -98 - +646 -0.04 - +0.25 :green_heart: -102 - 0 -1.25 - 0.0
arduino:avr:nano :grey_question: -98 - +646 -0.32 - +2.1 :green_heart: -102 - 0 -4.98 - 0.0
arduino:megaavr:nona4809 :small_red_triangle: 0 - +110 0.0 - +0.22 :green_heart: -116 - 0 -1.89 - 0.0
arduino:megaavr:uno2018 :small_red_triangle: 0 - +110 0.0 - +0.23 :green_heart: -116 - 0 -1.89 - 0.0
arduino:sam:arduino_due_x_dbg :small_red_triangle: 0 - +48 0.0 - +0.01 N/A N/A
arduino:samd:arduino_zero_edbg :small_red_triangle: 0 - +40 0.0 - +0.02 :green_heart: -112 - 0 -0.34 - 0.0
arduino:samd:mkr1000 :small_red_triangle: 0 - +40 0.0 - +0.02 :green_heart: -112 - 0 -0.34 - 0.0
arduino:samd:mkrfox1200 :small_red_triangle: 0 - +40 0.0 - +0.02 :green_heart: -112 - 0 -0.34 - 0.0
arduino:samd:mkrgsm1400 :small_red_triangle: 0 - +40 0.0 - +0.02 :green_heart: -112 - 0 -0.34 - 0.0
arduino:samd:mkrnb1500 :small_red_triangle: 0 - +40 0.0 - +0.02 :green_heart: -112 - 0 -0.34 - 0.0
arduino:samd:mkrvidor4000 :small_red_triangle: 0 - +40 0.0 - +0.02 :green_heart: -112 - 0 -0.34 - 0.0
arduino:samd:mkrwan1300 :small_red_triangle: 0 - +40 0.0 - +0.02 :green_heart: -112 - 0 -0.34 - 0.0
arduino:samd:mkrwan1310 :small_red_triangle: 0 - +40 0.0 - +0.02 :green_heart: -112 - 0 -0.34 - 0.0
arduino:samd:mkrwifi1010 :small_red_triangle: 0 - +40 0.0 - +0.02 :green_heart: -112 - 0 -0.34 - 0.0
arduino:samd:mkrzero :small_red_triangle: 0 - +40 0.0 - +0.02 :green_heart: -112 - 0 -0.34 - 0.0
arduino:samd:nano_33_iot :small_red_triangle: 0 - +40 0.0 - +0.02 :green_heart: -112 - 0 -0.34 - 0.0
Click for full report table
Board examples/AdvancedChatServer
flash
% examples/AdvancedChatServer
RAM for global variables
% examples/BarometricPressureWebServer
flash
% examples/BarometricPressureWebServer
RAM for global variables
% examples/ChatServer
flash
% examples/ChatServer
RAM for global variables
% examples/DhcpAddressPrinter
flash
% examples/DhcpAddressPrinter
RAM for global variables
% examples/DhcpChatServer
flash
% examples/DhcpChatServer
RAM for global variables
% examples/LinkStatus
flash
% examples/LinkStatus
RAM for global variables
% examples/PagerServer
flash
% examples/PagerServer
RAM for global variables
% examples/TelnetClient
flash
% examples/TelnetClient
RAM for global variables
% examples/UDPSendReceiveString
flash
% examples/UDPSendReceiveString
RAM for global variables
% examples/UdpNtpClient
flash
% examples/UdpNtpClient
RAM for global variables
% examples/WebClient
flash
% examples/WebClient
RAM for global variables
% examples/WebClientRepeating
flash
% examples/WebClientRepeating
RAM for global variables
% examples/WebServer
flash
% examples/WebServer
RAM for global variables
%
arduino:avr:leonardo 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 646 2.25 -92 -3.59 54 0.19 -102 -3.98 0 0.0 0 0.0 -98 -0.34 -102 -3.98 0 0.0 0 0.0 0 0.0 0 0.0 646 2.25 -92 -3.59 -62 -0.22 -102 -3.98 -98 -0.34 -102 -3.98 0 0.0 0 0.0
arduino:avr:mega 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 646 0.25 -92 -1.12 54 0.02 -102 -1.25 0 0.0 0 0.0 -98 -0.04 -102 -1.25 0 0.0 0 0.0 0 0.0 0 0.0 646 0.25 -92 -1.12 -62 -0.02 -102 -1.25 -96 -0.04 -102 -1.25 0 0.0 0 0.0
arduino:avr:nano 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 646 2.1 -92 -4.49 54 0.18 -102 -4.98 0 0.0 0 0.0 -98 -0.32 -102 -4.98 0 0.0 0 0.0 0 0.0 0 0.0 646 2.1 -92 -4.49 -62 -0.2 -102 -4.98 -96 -0.31 -102 -4.98 0 0.0 0 0.0
arduino:megaavr:nona4809 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 110 0.22 -116 -1.89 108 0.22 -116 -1.89 0 0.0 0 0.0 104 0.21 -116 -1.89 0 0.0 0 0.0 0 0.0 0 0.0 108 0.22 -116 -1.89 104 0.21 -116 -1.89 104 0.21 -116 -1.89 0 0.0 0 0.0
arduino:megaavr:uno2018 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 110 0.23 -116 -1.89 108 0.22 -116 -1.89 0 0.0 0 0.0 104 0.21 -116 -1.89 0 0.0 0 0.0 0 0.0 0 0.0 108 0.22 -116 -1.89 104 0.21 -116 -1.89 104 0.21 -116 -1.89 0 0.0 0 0.0
arduino:sam:arduino_due_x_dbg 0 0.0 N/A N/A 0 0.0 N/A N/A 0 0.0 N/A N/A 40 0.01 N/A N/A 48 0.01 N/A N/A 0 0.0 N/A N/A 40 0.01 N/A N/A 0 0.0 N/A N/A 0 0.0 N/A N/A 48 0.01 N/A N/A 40 0.01 N/A N/A 40 0.01 N/A N/A 0 0.0 N/A N/A
arduino:samd:arduino_zero_edbg 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0 40 0.02 -112 -0.34 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0
arduino:samd:mkr1000 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0 40 0.02 -112 -0.34 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0
arduino:samd:mkrfox1200 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0 40 0.02 -112 -0.34 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0
arduino:samd:mkrgsm1400 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0 40 0.02 -112 -0.34 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0
arduino:samd:mkrnb1500 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0 40 0.02 -112 -0.34 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0
arduino:samd:mkrvidor4000 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0 40 0.02 -112 -0.34 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0
arduino:samd:mkrwan1300 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0 40 0.02 -112 -0.34 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0
arduino:samd:mkrwan1310 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0 40 0.02 -112 -0.34 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0
arduino:samd:mkrwifi1010 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0 40 0.02 -112 -0.34 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0
arduino:samd:mkrzero 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0 40 0.02 -112 -0.34 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0
arduino:samd:nano_33_iot 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0 40 0.02 -112 -0.34 0 0.0 0 0.0 0 0.0 0 0.0 40 0.02 -112 -0.34 40 0.02 -112 -0.34 40 0.02 -112 -0.34 0 0.0 0 0.0
Click for full report CSV
Board,examples/AdvancedChatServer<br>flash,%,examples/AdvancedChatServer<br>RAM for global variables,%,examples/BarometricPressureWebServer<br>flash,%,examples/BarometricPressureWebServer<br>RAM for global variables,%,examples/ChatServer<br>flash,%,examples/ChatServer<br>RAM for global variables,%,examples/DhcpAddressPrinter<br>flash,%,examples/DhcpAddressPrinter<br>RAM for global variables,%,examples/DhcpChatServer<br>flash,%,examples/DhcpChatServer<br>RAM for global variables,%,examples/LinkStatus<br>flash,%,examples/LinkStatus<br>RAM for global variables,%,examples/PagerServer<br>flash,%,examples/PagerServer<br>RAM for global variables,%,examples/TelnetClient<br>flash,%,examples/TelnetClient<br>RAM for global variables,%,examples/UDPSendReceiveString<br>flash,%,examples/UDPSendReceiveString<br>RAM for global variables,%,examples/UdpNtpClient<br>flash,%,examples/UdpNtpClient<br>RAM for global variables,%,examples/WebClient<br>flash,%,examples/WebClient<br>RAM for global variables,%,examples/WebClientRepeating<br>flash,%,examples/WebClientRepeating<br>RAM for global variables,%,examples/WebServer<br>flash,%,examples/WebServer<br>RAM for global variables,%
arduino:avr:leonardo,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,646,2.25,-92,-3.59,54,0.19,-102,-3.98,0,0.0,0,0.0,-98,-0.34,-102,-3.98,0,0.0,0,0.0,0,0.0,0,0.0,646,2.25,-92,-3.59,-62,-0.22,-102,-3.98,-98,-0.34,-102,-3.98,0,0.0,0,0.0
arduino:avr:mega,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,646,0.25,-92,-1.12,54,0.02,-102,-1.25,0,0.0,0,0.0,-98,-0.04,-102,-1.25,0,0.0,0,0.0,0,0.0,0,0.0,646,0.25,-92,-1.12,-62,-0.02,-102,-1.25,-96,-0.04,-102,-1.25,0,0.0,0,0.0
arduino:avr:nano,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,646,2.1,-92,-4.49,54,0.18,-102,-4.98,0,0.0,0,0.0,-98,-0.32,-102,-4.98,0,0.0,0,0.0,0,0.0,0,0.0,646,2.1,-92,-4.49,-62,-0.2,-102,-4.98,-96,-0.31,-102,-4.98,0,0.0,0,0.0
arduino:megaavr:nona4809,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,110,0.22,-116,-1.89,108,0.22,-116,-1.89,0,0.0,0,0.0,104,0.21,-116,-1.89,0,0.0,0,0.0,0,0.0,0,0.0,108,0.22,-116,-1.89,104,0.21,-116,-1.89,104,0.21,-116,-1.89,0,0.0,0,0.0
arduino:megaavr:uno2018,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,110,0.23,-116,-1.89,108,0.22,-116,-1.89,0,0.0,0,0.0,104,0.21,-116,-1.89,0,0.0,0,0.0,0,0.0,0,0.0,108,0.22,-116,-1.89,104,0.21,-116,-1.89,104,0.21,-116,-1.89,0,0.0,0,0.0
arduino:sam:arduino_due_x_dbg,0,0.0,N/A,N/A,0,0.0,N/A,N/A,0,0.0,N/A,N/A,40,0.01,N/A,N/A,48,0.01,N/A,N/A,0,0.0,N/A,N/A,40,0.01,N/A,N/A,0,0.0,N/A,N/A,0,0.0,N/A,N/A,48,0.01,N/A,N/A,40,0.01,N/A,N/A,40,0.01,N/A,N/A,0,0.0,N/A,N/A
arduino:samd:arduino_zero_edbg,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0,40,0.02,-112,-0.34,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0
arduino:samd:mkr1000,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0,40,0.02,-112,-0.34,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0
arduino:samd:mkrfox1200,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0,40,0.02,-112,-0.34,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0
arduino:samd:mkrgsm1400,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0,40,0.02,-112,-0.34,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0
arduino:samd:mkrnb1500,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0,40,0.02,-112,-0.34,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0
arduino:samd:mkrvidor4000,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0,40,0.02,-112,-0.34,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0
arduino:samd:mkrwan1300,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0,40,0.02,-112,-0.34,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0
arduino:samd:mkrwan1310,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0,40,0.02,-112,-0.34,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0
arduino:samd:mkrwifi1010,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0,40,0.02,-112,-0.34,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0
arduino:samd:mkrzero,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0,40,0.02,-112,-0.34,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0
arduino:samd:nano_33_iot,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0,40,0.02,-112,-0.34,0,0.0,0,0.0,0,0.0,0,0.0,40,0.02,-112,-0.34,40,0.02,-112,-0.34,40,0.02,-112,-0.34,0,0.0,0,0.0

github-actions[bot] avatar Oct 07 '23 11:10 github-actions[bot]