SOC_Close

C Specification

#include <nitroWiFi/soc.h>
int SOC_Close ( int s );

Arguments

s Socket descriptor to close.

Return Values

0 Successful.
SOC_EINPROGRESS The close process is in progress.
SOC_EINVAL Invalid processing.
SOC_ENETRESET Socket library is not initialized.

Note: Additional errors may be generated and returned in future library releases. Treat all negative return values as general errors.

Description

This function closes the socket descriptor.

Currently, SOC_Close() performs an asynchronous close process whether the SOC_O_NONBLOCK flag is set or not.

You will need to call SOC_Close(s) again when you want to determine whether or not the socket has been completely closed and its memory region deallocated. When Soc_Close(s) is called for the first time, it will cause the socket to transition to its close process state. If this transition is a success, a 0 will return. On subsequent SOC_Close(s) calls, the progress of the current close process will return. If SOC_EINPROGRESS returns at this time, it indicates that the socket's close process is currently underway. If a 0 returns, it means that the close process has finished and its memory region has been deallocated.

It is blocked if there is no space in the command queue.

With SOC_SOCK_STREAM(TCP), once all the data is sent, the send thread is ended.

See Also

SOC_Shutdown, SOC_Fcntl

Revision History

05/18/2006 Method for confirming the end of the close process
12/12/2005 Changed the return values
09/13/2005 Initial version