cleaned clode, moved all tcp code into socket as class