Establishment and termination of a TCP connection