Walk through the TCP three-way handshake and the four-way teardown process, explaining what happens at each stage.