Hello, I have a questiona about how to manage persistent connections (HTTP1.1)

Once I have accepted a client, I create a new thread to recv/send data from/to client. To do that I suppose I have to run an infinite loop since the client closes the connection; if not, how can it be a persistent connection?

Code:
struct _INFOCS
{
SOCKET c;
SOCKET s;
};

unsigned _stdcall procClient(void *pvoid)
{
struct _INFOCS *ics=(struct _INFOCS*)pvoid;
while(1)
    {
    recv();
    (if client wants to close) -> break loop;//that line is what I can't imagine
    operations();
    send();
    }
ExitThread(0);
}
(NOTE: the struct _INFOCS have the sockets of the client and the server setted up on the accept action). I suppose that should be right, no? With that skeleton I have a persistent connection.

The problem is that the comercial navigators (I have tested it with nsn,ff,msie) never send the instruction to close the connection: the server always receives an http header with 'Connection: keep-alive' and 'Keep-Alive: x' (where 'x' is a number of seconds to wait till close the connection).

Does it mean that I have to create a timer to close the connection with the 'keep-alive' value? If yes, I have to update that timer with each recv of 'keep-alive', no?

I have read on the w3c that persistent connections doesn't allow idle connections, but how can I know what's an iddle connection if the request have a keep-alive=300 seconds (5 minutes)?


Thank's in advance
Niara