in reply to Can you tell me why?

In my experience, accept() returns a valid filehandle -- you can print directly to it without having to use a pipe. I would look into the HTTP::Daemon module from libwww-perl. It takes care of most of the dirty low-level work.

See also Randal Schwartz's Web Techniques columns, particularly 23 and 24. He builds a fork()ing mini web server there.

If you're determined to keep your existing code, I would look at your while loop. There seems to be no way to exit it, and perhaps the socket is timing out.