用户工具

站点工具

Action disabled: source

reference:library:ethernetmaintain

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中.

语法

Ethernet.maintain(); 

参数

返回值

字节:
0: nothing happened
1: renew failed
2: renew success
3: rebind fail
4: rebind success

返回主菜单

reference/library/ethernetmaintain.txt · 最后更改: 2023/06/07 04:24 由 127.0.0.1