用户工具

站点工具


reference:library:ethernetmaintain

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

后一修订版
前一修订版
reference:library:ethernetmaintain [2017/04/07 10:03] – 外部编辑 127.0.0.1reference:library:ethernetmaintain [2023/06/07 04:24] (当前版本) – 外部编辑 127.0.0.1
行 1: 行 1:
 +[[reference:librariy:ethernet|Ethernet]]
 +====== Ethernet.maintain() ======
 +
 +===== 描述 =====
 +
 +Allows for the renewal of DHCP leases. When assigned an IP address via DHCP, ethernet devices are given a lease on the address for an amount of time. With Ethernet.maintain(), it is possible to request a renewal from the DHCP server. Depending on the server's configuration, you may receive the same address, a new one, or none at all.
 +
 +You can call this function as often as you want, it will only re-request a DHCP lease when needed (returning 0 in all other cases). The easiest way is to just call it on every loop() invocation, but less often is also fine. Not calling this function (or calling it significantly less then once per second) will prevent the lease to be renewed when the DHCP protocol requires this, continuing to use the expired lease instead (which will not directly break connectivity, but if the DHCP server leases the same address to someone else, things will likely break).
 +
 +
 +Ethernet.maintain() 被添加到 Arduino 1.0.1版IDE中. 
 +===== 语法 =====
 +<code cpp>
 +Ethernet.maintain(); 
 +</code>
 +===== 参数 =====
 +
 +
 +===== 返回值 =====
 +
 +<code>
 +字节:
 +0: nothing happened
 +1: renew failed
 +2: renew success
 +3: rebind fail
 +4: rebind success
 +</code>
 +[[zh:reference:librariy:main|返回主菜单]]