fnReleaseTCP_Socket()

USOCKET fnReleaseTCP_Socket(USOCKET TCPSocket);

TCPSocket is the number of the TCP socket that is to be returned to the TCP socket pool.

The routine is usually used only when the socket is no longer required and will never be required again. All socket information is deleted, including any buffered TCP information - the routine is therefore not generally to be used by sockets working with buffered TCP in order not to lose any reserved buffer memory.

The return value is the original socket number if it was successfully returned to the socket pool. If the socket was invalid the return value SOCKET_NOT_FOUND indicates this.

Example

extern void fnStopFtp(void)
{
    fnReleaseTCP_Socket(FTP_TCP_socket);        // we close the sockets so that FTP is effectively dead.
    fnReleaseTCP_Socket(FTP_TCP_Data_socket);
    FTP_TCP_socket = -1;
}


See the following forum thread for additional details about working with TCP sockets: µTasker forum TCP discussion.

Related functions

fnGetTCP_Socket();
fnGetTCP_state();
fnTCP_Activity();
fnTCP_Connect();
fnTCP_close();




Please use the µTasker forum to ask specific questions.