Do I just call ipcfg_task_destroy(); from my task exit handler and that will look after all recouces for a simple UDP socket connection setup something like this (in short summary):
error = RTCS_create();
error = ipcfg_init_device(IPCFG_default_enet_device, IPCFG_default_enet_address);
error = ipcfg_bind_dhcp_wait(0, TRUE, &ip_data);
error = ipcfg_get_ip(IPCFG_default_enet_device, &ip_data));
sock = socket(PF_INET, SOCK_DGRAM, 0);
error = bind(sock, &local_sin, sizeof(local_sin));
//TX/RX
for(;{
count = sendto(sock, my_TXbuffer, i, 0, &remote_sin, sizeof(sockaddr_in));
count = recvfrom(sock, my_RXbuffer, 256, 0, &remote_sin, &remote_len);
}
If not, what recources do I have to free up in my exit handler? RTCS? Sockets? Bind?
Solved! Go to Solution.
ipcfg_task_destroy() only destroys the task created by ipcfg_task_create() which only periodically checks the line status and rebinds ip address if necessary. This is not what you want in your example above.
Exit handler should at least shutdown/free up sockets created by the task.
It can optionally unbind ip address if not used anywhere else.
RTCS itself continues to work in separate tasks.
PetrM
ipcfg_task_destroy() only destroys the task created by ipcfg_task_create() which only periodically checks the line status and rebinds ip address if necessary. This is not what you want in your example above.
Exit handler should at least shutdown/free up sockets created by the task.
It can optionally unbind ip address if not used anywhere else.
RTCS itself continues to work in separate tasks.
PetrM