Idioms: Building High Performance Network Servers using Tcl by Todd Coram, describes and illustrates the following network programming strategies:

  • Use Events instead of Threads/Processes
  • Don't Block for your Clients
  • Read messages chunk by available chunk
  • Buffer data to disk
  • Carry state using fileevent
  • Keep Tasks Short
  • Decode complex protocols using a state machine
  • Timeout stale connections