Use tcdrain() instead of calculating the transmission time manually

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