httpGet example doesn't work

Hello,

I followed the documentation to compile and successfully update the httpGet app.

But the httpGet App couldn’t establish a connection after 30 seconds.

End of the output of httpGet is like below

Apr  7 06:34:52 swi-mdm9x28-wp user.info Legato:  INFO | supervisor[1101]/supervisor T=main | app.c CreateFileLink() 2154 | Created file link '/tmp/legato/serviceDirectoryClient' to '/legato/systems/current/appsWriteable/httpGet/tmp/legato/serviceDirectoryClient'.
Apr  7 06:34:52 swi-mdm9x28-wp user.info Legato:  INFO | supervisor[1101]/supervisor T=main | proc.c proc_Start() 1403 | Starting process 'httpGet' with pid 30761
Apr  7 06:34:52 swi-mdm9x28-wp user.info Legato:  INFO | supervisor[30761]/supervisor T=main | proc.c proc_Start() 1363 | Execing 'httpGet'
Apr  7 03:34:52 swi-mdm9x28-wp user.warn Legato: -WRN- | _UNKNOWN_[30761]/framework T=main | fdMonitor.c le_fdMonitor_Create() 449 | FD Monitor object name 'httpGet.httpGetComponent.le_data' truncated to 'httpGet.httpGetComponent.le_dat'.
Apr  7 06:34:52 swi-mdm9x28-wp user.info Legato:  INFO | httpGet[30761] | HTTP Get!
Apr  7 06:34:52 swi-mdm9x28-wp user.notice kernel: [65887.209909] audit: type=1400 audit(1649302492.191:12): lsm=SMACK fn=smack_inode_getattr action=denied subject="app.httpGet" object="admin" requested=r pid=30761 comm="httpGet" path="pipe:[383245]" dev="pipefs" ino=383245
Apr  7 03:34:52 swi-mdm9x28-wp user.info Legato:  INFO | httpGet[30761]/httpGetComponent T=main | httpGet.c _httpGetComponent_COMPONENT_INIT() 133 | Requesting connection...
Apr  7 03:35:22 swi-mdm9x28-wp user.err Legato: =ERR= | httpGet[30761]/httpGetComponent T=main | httpGet.c TimeoutHandler() 55 | Couldn't establish connection after 30 seconds
Apr  7 06:35:22 swi-mdm9x28-wp user.info Legato:  INFO | supervisor[1101]/supervisor T=main | proc.c proc_SigChildHandler() 2079 | Process 'httpGet' (PID: 30761) has exited with exit code 1.
Apr  7 06:35:22 swi-mdm9x28-wp user.warn Legato: -WRN- | supervisor[1101]/supervisor T=main | app.c app_SigChildHandler() 4066 | Process 'httpGet' in app 'httpGet' faulted: Ignored.
Apr  7 06:35:22 swi-mdm9x28-wp user.info Legato:  INFO | supervisor[1101]/supervisor T=main | app.c app_StopComplete() 4753 | app 'httpGet' has stopped.
Apr  7 06:35:22 swi-mdm9x28-wp user.info Legato:  INFO | supervisor[1101]/supervisor T=main | apps.c DeactivateAppContainer() 374 | Application 'httpGet' has stopped.

I have an active wifi connection (client mode), I did it with this doc and I can successfully execute wget and curl commands over ssh.

What is the reason for this problem?

Thanks

If you already have data connection, there is no need to establish data connection inside the code:



COMPONENT_INIT
{
    printf("HTTP Get!\n");
#if 0
    le_timer_Ref_t timerPtr = le_timer_Create("Connection timeout timer");
    le_clk_Time_t interval = {TIMEOUT_SECS, 0};
    le_timer_SetInterval(timerPtr, interval);
    le_timer_SetHandler(timerPtr, &TimeoutHandler);
    WaitingForConnection = true;
    le_timer_Start(timerPtr);

    le_data_AddConnectionStateHandler(&ConnectionStateHandler, NULL);
    LE_INFO("Requesting connection...");
    ConnectionRef = le_data_Request();
#else

    GetUrl();
#endif
}

Thanks, you solved the problem. I had not read the codes :smile: