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.

NDK Function definitions for TCP Client

Hi,

I would like to implement a TCP Client code with TI RTOS NDK. I did not find any off-the-shelf example. Is there any? Well, based on  tcpSendReceive.c file I started to implement a clien side code to uC.

My problem is when I call:

inet_ntop(AF_INET,"192.168.3.10",&(localAddr.sin_addr));

It says 

Description	Resource	Path	Location	Type
<a href="file:/c:/ti/ccsv6/tools/compiler/dmed/HTML/225.html">#225-D</a>  function "inet_addr" declared implicitly	tcpEcho.c	/tcpEcho_EK_TM4C129EXL_TI_TivaTM4C129ENCPDT	line 115	C/C++ Problem

What header files should I include to make it work?

The most recent version of SPRU524J on chapter 5 says NETTOLS.H must be included but I can not find it.

Thank you

PS.: If there were a fully working TCP Client for TI RTOS with NDK, that would be very nice.

  • when include the following:
    #include <ti/ndk/inc/nettools/nettools.h>

    I have 85 itemn error such as:

    Description Resource Path Location Type
    #20 identifier "HANDLE" is undefined .ccsproject /tcpEcho_EK_TM4C129EXL_TI_TivaTM4C129ENCPDT line 102, external location: C:\ti\tirtos_tivac_2_16_00_08\products\ndk_2_25_00_09\packages\ti\ndk\inc\nettools\inc\configif.h C/C++ Problem

    and this

    Description Resource Path Location Type
    #20 identifier "uint" is undefined .ccsproject /tcpEcho_EK_TM4C129EXL_TI_TivaTM4C129ENCPDT line 193, external location: C:\ti\tirtos_tivac_2_16_00_08\products\ndk_2_25_00_09\packages\ti\ndk\inc\nettools\inc\configif.h C/C++ Problem

    How can I include the nettools.h that way to keep my project clean?
  • Hi Daniel,

    You need to use NDK's BSD support layer, so remove the include you have now (#include <ti/ndk/inc/nettools/nettools.h>)

    and instead add  ti/ndk/inc/bsd (from your ndk installation) to your compiler search path, and include:

    #include <sys/socket.h>
    #include <arpa/inet.h> 
    

    inet.h has the function definition that you're wanting to use.

    Best,

    Alexander

  • Hello Alexander,
    Thank you very much. It works!