RTCS_create(), where is RTCS_Destroy()?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RTCS_create(), where is RTCS_Destroy()?

Jump to solution
1,333 Views
CarlFST60L
Senior Contributor II

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(;:smileywink:{

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?

 

Message Edited by CarlFST60L on 2010-01-31 04:23 AM
Labels (1)
Tags (1)
0 Kudos
1 Solution
338 Views
PetrM
Senior Contributor I

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

 

View solution in original post

0 Kudos
1 Reply
339 Views
PetrM
Senior Contributor I

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

 

0 Kudos