tcp_timer.c File Reference

TCP timer management. More...

#include "core/net.h"
#include "core/socket.h"
#include "core/tcp.h"
#include "core/tcp_misc.h"
#include "core/tcp_timer.h"
#include "date_time.h"
#include "debug.h"

Go to the source code of this file.




void tcpTick (void)
 TCP timer handler. More...
void tcpCheckRetransmitTimer (Socket *socket)
 Check retransmission timer. More...
void tcpCheckPersistTimer (Socket *socket)
 Check persist timer. More...
void tcpCheckKeepAliveTimer (Socket *socket)
 Check TCP keep-alive timer. More...
void tcpCheckOverrideTimer (Socket *socket)
 Check override timer. More...
void tcpCheckFinWait2Timer (Socket *socket)
 Check FIN-WAIT-2 timer. More...
void tcpCheckTimeWaitTimer (Socket *socket)
 Check 2MSL timer. More...

Detailed Description

TCP timer management.


SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Oryx Embedded SARL (

Definition in file tcp_timer.c.

Macro Definition Documentation



Definition at line 32 of file tcp_timer.c.

Function Documentation

◆ tcpCheckFinWait2Timer()

void tcpCheckFinWait2Timer ( Socket socket)

Check FIN-WAIT-2 timer.

The FIN-WAIT-2 timer prevents the connection from staying in the FIN-WAIT-2 state forever

[in]socketHandle referencing the socket

Definition at line 393 of file tcp_timer.c.

◆ tcpCheckKeepAliveTimer()

void tcpCheckKeepAliveTimer ( Socket socket)

Check TCP keep-alive timer.

The TCP keep-alive timer feature provides a mechanism to identify dead connections. The other useful goal of keep-alive is to prevent inactivity from disconnecting the channel

[in]socketHandle referencing the socket

Definition at line 240 of file tcp_timer.c.

◆ tcpCheckOverrideTimer()

void tcpCheckOverrideTimer ( Socket socket)

Check override timer.

To avoid a deadlock, it is necessary to have a timeout to force transmission of data, overriding the SWS avoidance algorithm. In practice, this timeout should seldom occur (refer to RFC 1122, section

[in]socketHandle referencing the socket

Definition at line 320 of file tcp_timer.c.

◆ tcpCheckPersistTimer()

void tcpCheckPersistTimer ( Socket socket)

Check persist timer.

The TCP persist timer is set by one end of a connection when it has data to send, but has been stopped because the other end has advertised a zero-sized window

[in]socketHandle referencing the socket

Definition at line 183 of file tcp_timer.c.

◆ tcpCheckRetransmitTimer()

void tcpCheckRetransmitTimer ( Socket socket)

Check retransmission timer.

[in]socketHandle referencing the socket

Definition at line 96 of file tcp_timer.c.

◆ tcpCheckTimeWaitTimer()

void tcpCheckTimeWaitTimer ( Socket socket)

Check 2MSL timer.

The purpose of the TIME-WAIT timer is to prevent delayed packets from one connection from being accepted by a later connection

[in]socketHandle referencing the socket

Definition at line 419 of file tcp_timer.c.

◆ tcpTick()

void tcpTick ( void  )

TCP timer handler.

This routine must be periodically called by the TCP/IP stack to handle retransmissions and TCP related timers (persist timer, FIN-WAIT-2 timer and TIME-WAIT timer)

Definition at line 56 of file tcp_timer.c.