RTCS_create(), where is RTCS_Destroy()?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

RTCS_create(), where is RTCS_Destroy()?

跳至解决方案
1,794 次查看
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
标签 (1)
标记 (1)
0 项奖励
回复
1 解答
799 次查看
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 项奖励
回复
1 回复
800 次查看
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 项奖励
回复