When a client disconnects, select() will place that descriptor in the readset. I imagine that after select() returns you loop through the descriptors and read from the ones that are left in the readset. When you read from the descriptor that disconnected, read() will return 0.
|