Setting IP, Gateway IP, and Netmask
Wi-Fi is a separate network interface and so it has its own IP address, which is set using the wln.ip property. This address is different from the IP address of the Ethernet interface (see net.ip). We noticed that many people find it "unusual" that a Tibbo device could have two IP addresses. In fact, this is completely normal. On a PC, every network interface has an IP address of its own as well.
Technically speaking, the IP address configuration can be done at any time. This topic has been placed into this section to remind you that the IP of the wln. object has to be set, if not right after boot, then at a later point. If your application uses a static IP, then setting it in the boot section of your code is a good idea. If the application obtains the IP address through DHCP, then the IP can only be set after communicating with the DHCP server, and this will only be possible after associating with an access point. You may even need to set the IP address repeatedly if your product switches between different networks (access points).
There are also the wln.gatewayip and wln.netmask properties that may need to be set along with the IP address. This is optional and is only required if your device will have to establish connections to network hosts outside of your LAN.
Note that the IP address, gateway IP, and netmask of the Wi-Fi interface can't be set when there is at least one socket in your system that is currently not closed and operates on the Wi-Fi interface (sock.statesimple <> 0 — PL_SSTS_CLOSED and sock.currentinterface = 2 — PL_SOCK_INTERFACE_WLN).
Our DHCP library can handle IP address, gateway IP address, and netmask configuration for both the Ethernet (net.) and Wi-Fi (wln.) interfaces of your device. Use it and save yourself a ton of work!
The WM2000 and the WS1102 allow you to delegate DHCP to the internal process of Tibbo OS (TiOS). This really speeds up the IP address procurement! The new wln.dhcp property of the wln. object is provided for enabling this "internal DHCP." For more information, see Device Configuration Block (WM2000 and WS1102 Only).