AnsweredAssumed Answered

Automatic socket close?

Question asked by Teckna Teckna on Nov 30, 2012
Latest reply on Dec 3, 2012 by Teckna Teckna

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

Outcomes