Restructured Tcp implementation

restructured TcpSocket implementation