# TCP Puzzles 1-2

DevFeed: [TCP Puzzles 1-2](<https://devfeed.tech/articles/tcp-puzzles-1-2-38988.md>)

Original publisher: [Read original article](<https://idea.popcount.org/2019-09-30-tcp-puzzles-1-2>)

Author: Marek

Published: 2019-09-29T22:00:00Z

Content type: tutorial

Language: en

Sources: [Marek Majkowski](<https://devfeed.tech/sources/marek-majkowski.md>)

Topics: [Linux](<https://devfeed.tech/topics/linux.md>), [networking](<https://devfeed.tech/topics/networking.md>), [Python](<https://devfeed.tech/topics/python.md>)

Tags: [implementation](<https://devfeed.tech/tags/implementation.md>), [linux](<https://devfeed.tech/tags/linux.md>), [networking](<https://devfeed.tech/tags/networking.md>), [python](<https://devfeed.tech/tags/python.md>), [tcp](<https://devfeed.tech/tags/tcp.md>)

## AI overview

This tutorial presents two TCP puzzles based on Linux networking behavior. It examines write buffering versus POLLOUT and the effects of statement ordering on TIME-WAIT socket behavior, using small Python programs to illustrate implementation details and system-dependent outcomes.

## Source excerpt

TCP Puzzles 1-2 Recently I've been spending more time looking into Linux TCP implementation, trying to better understand some corner cases. Here are two TCP puzzles. Using obvious, almost trivial, Python snippets, we can show really important design choices made deep in the networking stack. All we need is a bit of time... and courage to go into the Linux internals! 1. Write buffer vs POLLOUT Imagine a TCP server and a client connected to it. The server has plenty of data available.