Complete implementation of synchronous TCP driver