How do I include & use the DHCP server?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

[WICED-SDK-2.2.1]

What is the correct way to include the DHCP server code into an application?

0 Likes
1 Reply
Anonymous
Not applicable
There are several ways to use the DHCP server.

Most ppl use the server indirectly when bringing up a softAP interface using the wiced_network_up() API.

The <SDK>/Apps/snip/apsta application brings a softAP network interface up and starts a DHCP server as part of the network up call:

   wiced_network_up(WICED_AP_INTERFACE, WICED_USE_INTERNAL_DHCP_SERVER, &ap_ip_settings);

If you want to directly call the server, then, just like other libraries you need to add the server to your application.mk makefile:

$(NAME)_COMPONENTS += daemons/dhcp_server

Then, in your application, you can call server functions directly:

wiced_start_dhcp_server()

wiced_stop_dhcp_server()

The library starts giving out IP addresses using the current interface IP address + 1 and netmask.
0 Likes