Skip to content
Lucio Santi edited this page Aug 3, 2014 · 4 revisions

PTC WikiCode overviewthread

This module implements the threads on which the protocol bases its operation:

  • The Clock thread is responsible for simulating the system clock. Every CLOCK_TICK seconds (by default being 0.1), it will call the tick method defined by PTCProtocol (see protocol).
  • The PacketReceiver thread monitors the socket and receives packets from it. Once a packet arrives, it will invoke the handle_incoming method defined by PTCProtocol, which in turn will delegate its work to the IncomingPacketHandler (see handler).
  • Finally, the PacketSender thread sends data as well as FIN packets. This behavior is implemented by the method handle_outgoing on PTCProtocol, which is executed in the context of this thread every time that some event that might trigger new data to be sent occurs (e.g., incoming ACKs or send calls performed by the user).

Clone this wiki locally