Tip: Using a Timer - ANLAB-KAIST/KENSv3 GitHub Wiki
When implementing timeouts (e.g. retransmission time out), you have to use timers.
In KENS, there is TimerModule
class for the purpose.
Use the addTimer
method to set a new timer and cancel it via the cancelTimer
method.
After the timeAfter
duration (nanoseconds), which is a parameter of addTimer
, the timerCallback
method in TCPAssignment.cpp
is called.
Note that payload
's type is std::any
. Check std::any
to learn how to use std::any
class.