Jump to main content

##

# TCPIP_TCP_Close Function

## C

    bool TCPIP_TCP_Close(
        TCP_SOCKET hTCP
    );

## Description

Graceful Option Set: If the graceful option is set for the socket (default), a TCPIP_TCP_Disconnect will be tried. If the linger option is set (default) the TCPIP_TCP_Disconnect will try to send any queued TX data before issuing FIN. If the FIN send operation fails or the socket is not connected the abort is generated.

Graceful Option Not Set: If the graceful option is not set, or the previous step could not send the FIN,a TCPIP_TCP_Abort is called, sending a RST to the remote node. Communication is closed, the socket is no longer valid and the associated resources are freed.

## Preconditions

TCP socket should have been opened with TCPIP_TCP_ServerOpen()/TCPIP_TCP_ClientOpen(). hTCP - valid socket.

## Parameters

Parameters | Description
--- | ---
hTCP | Handle to thesocket to disconnect and close.

## Returns

- True - Indicates success.
- False - Indicates failure (No such socket).

## Remarks

None.