another way to implement these kinds of timeouts is
alarm(), see sleep(2).

Yes, I know.

But it was just a simplified example to explain my real need:
- 'receiver' process
- another 'sender' process, which should have a possibility to close the TCP connection, and relase 'receiver' from read() call...

Pavel