Other Parts Discussed in Thread: SYSCONFIG
Hello TI community,
My previous post got set to resolved somehow by mistake. I couldnt find setting as unresolved so making this new post.
To Summarise HTTP Example when set with a static IP
- Does not work with TI-RTOS thread. Only Pthread
- Takes 2-3 seconds for each HTTP call
- A high priority on thread type fails
This is with pthread priority 10 as well as Ti rtos task priority 10

I'm more interested in using Ti-rtos thread type rather than pthread. I thought the implementations should be interchangeable. Why is that not the case?
I call this function before creation of httpTask or httpThread below. I made a slight modification to answer in the linked post by passing the Config handle and setting it as a hook in .sysconfig
void setDNS(void* hCfg){
uint32_t dns;
// Manually add the DNS server
dns = inet_addr("192.168.86.1");
CfgAddEntry(hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_DOMAINNAMESERVER,
0, sizeof(dns), (unsigned char *)&dns, 0);
}
Now for the case of Pthread and Ti-rtos task priority set to 1.
TI-RTOS Task :
// Task Initialisation
Error_Block eb;
Error_init(&eb);
Task_Params params;
Task_Handle httpTaskHandle;
Task_Params_init(¶ms);
params.instance->name = "httpTask";
params.priority = 1;
params.arg0 = 0;
params.stackSize = HTTPTASKSTACKSIZE;
httpTaskHandle = Task_create((Task_FuncPtr)httpTask, ¶ms, &eb);
if (httpTaskHandle == NULL) {
/* Error: could not create NDK stack thread */
Display_printf(display, 0, 0,
"netIPAddrHook: Task_create() failed\n");
while(1);
}
createTask = false;
// HTTP Task Thread Implementation
ret = HTTPClient_setHeader(httpClientHandle,
HTTPClient_HFIELD_REQ_USER_AGENT, USER_AGENT,
strlen(USER_AGENT) + 1, HTTPClient_HFIELD_PERSISTENT);
if (ret < 0) {
printError("httpTask: setting request header failed", ret);
}
for(int index = 0; index < 2; ++index){
Task_sleep(3000);
ret = HTTPClient_connect(httpClientHandle, HOSTNAME, 0, 0);
if(ret >= 0) break;
}
if (ret < 0) {
printError("httpTask: connect failed", ret);
}

PThread : /* Set priority and stack size attributes */
pthread_attr_init(&attrs);
priParam.sched_priority = 1;
detachState = PTHREAD_CREATE_DETACHED;
retc = pthread_attr_setdetachstate(&attrs, detachState);
if (retc != 0) {
Display_printf(display, 0, 0,
"netIPAddrHook: pthread_attr_setdetachstate() failed\n");
while (1);
}
pthread_attr_setschedparam(&attrs, &priParam);
retc |= pthread_attr_setstacksize(&attrs, HTTPTASKSTACKSIZE);
if (retc != 0) {
Display_printf(display, 0, 0,
"netIPAddrHook: pthread_attr_setstacksize() failed\n");
while (1);
}
retc = pthread_create(&thread, &attrs, httpThread, 0);
if (retc != 0) {
Display_printf(display, 0, 0,
"netIPAddrHook: pthread_create() failed\n");
while (1);
}
createTask = false;
// Sleep from unistd library
ret = HTTPClient_setHeader(httpClientHandle,
HTTPClient_HFIELD_REQ_USER_AGENT, USER_AGENT,
strlen(USER_AGENT) + 1, HTTPClient_HFIELD_PERSISTENT);
if (ret < 0) {
printError("httpTask: setting request header failed", ret);
}
for(int index = 0; index < 2; ++index){
sleep(3);
ret = HTTPClient_connect(httpClientHandle, HOSTNAME, 0, 0);
if(ret >= 0) break;
}
if (ret < 0) {
printError("httpTask: connect failed", ret);
}[CORTEX_M4_0] Network Added:
If-1:192.168.86.220
Sending a HTTP GET request to 'http://www.google.com/'
HTTP Response Status Code: 200
.. Payload here but removed for simplicity
Received 13433 bytes of payload