Dhcp_start()

Top  Previous  Next

Description:

API procedure, starts DHCP client on the specified network interface.

Syntax:

function dhcp_start(interface as pl_sock_interfaces, byref requested_ip as string, byref host_name as string) as en_dhcp_status_codes

Returns:

One of these en_dhcp_status_codes: DHCP_STATUS_OK, DHCP_STATUS_OUT_OF_SOCKETS, DHCP_STATUS_INVALID_INTERFACE

See Also:

Step-by-step Usage Instructions, Operation Details

 


Part

Description

interface

Network interface to start the DHCP client on:

0- PL_SOCK_INTERFACE_NULL: do not choose this one, it is for a "non-existing interface".

1- PL_SOCK_INTERFACE_NET: Ethernet (net.) interface.

2- PL_SOCK_INTERFACE_WLN: Wi-Fi (wln.) interface.

requested_ip

Optionally provide an IP address that the device wishes to use or continue using. This is typically an IP address that was previously obtained. Leave this argument empty if no IP is being requested specifically. This argument will be ignored if the data format is wrong (for example, "192.168.1").

host_name

The device name to register with the DHCP server. Add DHCP_MAX_HOST_NAME_LEN option to global.tbh for this to work. Leave this argument empty if you don't wish to send the host name. Name length can't exceed the value set by DHCP_MAX_HOST_NAME_LEN.

Details

The interface option 0- PL_SOCK_INTERFACE_NULL exists because the interface argument is of the pl_sock_interfaces type, which defines available network interfaces for the sock. object (see, for example, sock.targetinterface). Obviously, there is no point selecting this option for dhcp_start().