refactor tcp client1 and ser1