tcp function tested ok