Automatic socket close?

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

Automatic socket close?

跳至解决方案
1,579 次查看
Teckna
Contributor V

Hi everyone,

I'm using CW 10.2, MWX 3.8.1 and Kinetis MK60DN512.

I'd like to know if the task destruction close automatically the socket opened by the task itself.

Example:

Task1---------

s1 = socket( ... );

...

err = bind( s1, ... );

...

err = listen( s1, ... );

...

s2 = accept( s1, ... );

...

shutdown( s2, FLAG_ABORT_CONNECTION );

shutdown( s1, FLAG_ABORT_CONNECTION );

Task2---------

...

_task_destroy( Task1_id );

...

If the task 2 calls the _task_destroy function when the task 1 is executing one instruction between the socket creation (s1 = socket( ... );) and the first socket close (shutdown( ... );), are the two sockets closed automatically or must they be closed manually before or after the _task_destroy function?

Many thanks

Teckna

标签 (1)
0 项奖励
回复
1 解答
1,375 次查看
butok
NXP Employee
NXP Employee

Hi Teckna,

The opened sockets must be closed manually before the task destroying.

Best regards,

Andrey Butok

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,376 次查看
butok
NXP Employee
NXP Employee

Hi Teckna,

The opened sockets must be closed manually before the task destroying.

Best regards,

Andrey Butok

0 项奖励
回复
1,375 次查看
Teckna
Contributor V

Many thanks, Andrey,

Teckna

0 项奖励
回复