Automatic socket close?

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

Automatic socket close?

Jump to solution
530 Views
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

Labels (1)
0 Kudos
1 Solution
326 Views
butok
NXP Employee
NXP Employee

Hi Teckna,

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

Best regards,

Andrey Butok

View solution in original post

0 Kudos
2 Replies
327 Views
butok
NXP Employee
NXP Employee

Hi Teckna,

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

Best regards,

Andrey Butok

0 Kudos
326 Views
Teckna
Contributor V

Many thanks, Andrey,

Teckna

0 Kudos