in reply to When do I stop reading?
Actually, the problem is in the server - I can't figure out when to make it stop reading. I could have the client send some kind of EOF indicator (and actually that is what I was doing - it's an XML doc so I watched for the closing tag) - but what if the request is malformed and the client doesn't send an EOF? I think that alarm() idea will work well, thanks, Shendal.