Hi guyz,
Working on MQX3.8 and used the htpps server example code to host few webpages on the MQX. Now I have to switch between static and dynamic ip address for the server. so need to stop/restart the server.
I used httpd_server_stop(server) to stop the server. but I guess it does not destroy the httpd server task and keeps on creating new "https server" tasks until the block limit is reached and the last task comes up with PART : out of blocks error and the system freezes .
Any help??
Thanks
Hi Nikhil,
I thinks its a problem with the minimum footprint settings in rtcs. Try to change following variables in user config:
#define RTCSCFG_SOCKET_PART_GROW 2
#define RTCSCFG_SOCKET_PART_MAX 11
After that it works for me.
Best regards,
Tobias
Hi Tobias,
First of all thanks for taking time to answer my question.
I actually had tried that already but that did not work in my case.
Also you can change that config during run time as well by following lines before you instantiate RTSC stack by RTCS_create()
_RTCS_socket_part_grow = 2;
_RTCS_socket_part_max = 16;
In my case I use httpd_server_run("httpd server") start the server
And when I change the ip address from dhcp to a static or the other way around, I reset the server (if i dont reset server, i cannot see the webpages on new ip address) by something like this
void restart_http_server(){
uint_32 rtcs_create =0;
uint_32 error = 0;
do{
error = httpd_server_stop(server);
}while(error != 0);
_task_destroy(_task_get_id_from_name("httpd server")); //destroy the httpd server
printf("\r\n Unbinding ENET Device...");
do{
error = ipcfg_unbind(BSP_DEFAULT_ENET_DEVICE);
}while(error != IPCFG_OK);
/* restart the tast */
printf("\r\n Restarting Server...");
_task_restart(_task_get_id_from_name("http_serv"),&rtcs_create,FALSE); //restart the task that started the server
_time_delay(200);
}
Hope this makes sense