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.

Sntp isn't working on the httpserver sample

Hello,

i was trying to add the sntp request to the httpserver and i faced some compilation problem but it had been resolved @

but the problem that the sntp isn't working such that the getaddrinfo always fail and return -2. the sample is attached1447.httpserver.zip 

So please advice.

Thanks,

Mohammed Fawzy

  • Mohammed,

    I looked through your project. I think you need to update your SNTP code. Maybe this has changed in the recent TI-RTOS 2.16 release. Here is a brief list to get you started.

    Look in the Network Services User Guide for help.

    CCS > Help Contents
    TI-RTOS for Tiva C 2.16.00.08 > Documentation Links
    TI-RTOS Network Services User Guide > SNTP Client

    You are on a TivaC so I'll assume you are using Ethernet; you will want the NDK option.

    var Sntp = xdc.useModule('ti.net.sntp.Sntp');
    Sntp.networkStack = Sntp.NDK;

    You can find the API Reference here.

    CCS > Help Contents
    TI-RTOS for Tiva C 2.16.00.08 > Documentation Links
    TI-RTOS Network Services APIs (doxygen) > SNTP Client

    Looks like you are getting the following error: EAI_NONAME. Look in the following header file for the error codes.

    tirtos_2_16_00_08/products/ndk_2_25_00_09/packages/ti/ndk/inc/serrno.h

    Looks like maybe the sockaddr_in structure is not setup correctly. Try the following (which I took from the docs).

    struct sockaddr_in ntpAddr;

    ntpAddr.sin_family = AF_INET;
    ntpAddr.sin_port = htons(123);
    inet_pton(AF_INET, "192.168.1.100", &(ntpAddr.sin_addr.s_addr));

    See if that helps.

    ~Ramsey