This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Select dhcp client mode at runtime in ndk

We are developing an ethernetIP application on am335x which uses NDK stack. Now we have a requirement where the enabling of dhcp client need to be done at  runtime. ie At startup,the application decides either to use a static ip or enable dhcp.

Does NDK support this requirement. 

I am using ndk version 2.22.3.20.

Prajith

  • Hi Prajith,

    Yes, you can configure the app for DHCP client mode at run time.  You must use the NDK C configuration APIs:

            CfgAddEntry( hCfg, CFGTAG_SERVICE, CFGITEM_SERVICE_DHCPCLIENT, 0,
                         sizeof(dhcpc), (UINT8 *)&dhcpc, 0 );

    Please look at this NDK 2.0.0 version of the client example that has the full code for this:

    2671.client.c

    You can also find out more details on the NDK configuration in the "TI Network Developer's Kit (NDK) v2.21 API
    Reference Guide" , under Appendix G "Legacy Configuration Manager API" in the NDK.

    Also, please see this post as it is related and may be helpful.

    Steve

  • Hi Steve,

                        Thanks for the reply. I was able to implement dhcp at run time. Thanks a lot.  

    Thanks,

    Prajith