.dhcp Property
Function: |
Indicates whether DHCP is enabled. |
Type: |
Enum (no_yes, byte) |
Value Range: |
|
See Also: |
Details
This property is only available on the WM2000 and the WS1102.
This property replaces the functions of the DHCP library and delegates them to the internal process of TiOS. If wln.autodhcp is set to 1 — YES, wln.dhcp will be enabled automatically at boot.
Enabling wln.dhcp before your app starts shaves off additional milliseconds off the wait for an IP address. This means that your app will be ready to perform its network-related tasks even sooner!
If wln.autoconnect is disabled, wln.dhcp must be called before wln.boot to enable DHCP functionality in the traditional Wi-Fi operating mode. For example, at a minimum, your code should resemble the following example:
sub on_sys_init()
wln.dhcp = YES
wln.boot(0)
wln.associate("","YourNetwork",0,PL_WLN_BSS_MODE_INFRASTRUCTURE)
'In this example, an empty string is passed for the bssid parameter because you can
'connect to any router with the SSID specified in the ssid parameter
'A 0 is passed for the channel, the device will associate on any channel
end sub
If you disable the DHCP client (wln.dhcp = 0 — NO) and disassociate from a network, it will remain disabled when you reconnect and no DHCP events will be generated.