Use tcdrain() instead of calculating the transmission time manulally

I wrote a patch that implements #208.
I tested it and It seems to work fine.