added support for posix threads
modified packet flushing
defined timer constant
flushing/rate/loss timer in separate thread