Fix TCP connecting and writing in the libevent driver.