fnTCP_Activity()

void fnTCP_Activity(USOCKET TCP_socket);

TCPSocket is the number of the TCP socket whose idle timer is to be retriggered.


The routine is used by application layer code to retrigger the idle timer of a TCP connection. This allows activity on another interface or another TCP connection to be used to retrigger an otherwise non-related TCP connection so that it also stays open.

The function returns void and so gives no error messages if an attempt was made to trigger an invalid socket or a socket which is presently not connected. The function fnGetTCP_state() can be used if the present state of the socket is important.

The function is only available when the project define DATA_PORT_TRIGGERS_CONTROL is set. It is inherently used by FTP where data activity retriggers the FTP control connection so that the FTP control connection doesn't timeout during long data transfers. This is shown in the example below as reference.

Example

// Local listener to TCP FTP data port
//
static int fnFTP_Data_Listener(USOCKET cSocket, unsigned char ucEvent, unsigned char *ucIp_Data, unsigned short usPortLen)
{
    if (cSocket != FTP_TCP_Data_socket) {
        return APP_REJECT;                                                // ignore if not our socket handle
    }

#ifdef DATA_PORT_TRIGGERS_CONTROL 
    fnTCP_Activity(FTP_TCP_socket);                                      // retrigger control socket on data socket activity
#endif
    ....
}


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

Related functions

fnGetTCP_Socket();
fnReleaseTCP_Socket();
fnTCP_Listen();
fnGetTCP_state();
fnTCP_Connect();
fnTCP_close();




Please use the µTasker forum to ask specific questions.