Barry Brevik wrote: > I'm developing a special purpose mailer for internal company use. The > application is being developed, and will run on Windows 2000. It is a > requirement that there be multiple processes all listening on port 25 for > inbound connections. > > Two weeks ago, my program would fork() every time it received a connection. > This worked great until I discovered that I can only fork() 64 processes, > even if those processes terminate, before Perl refuses to fork any more > processes with $! = "resource temporarily unavailable". I'm quite sure the > children are being cleaned up properly.
I assume you're running on Win32 ? > This week I said "a ha!" I'll just pre-fork 16 children all listening on port > 25, and each will handle a new connection after it finishes with the current > one. Unfortunately, only the first process (and it is always the first) > actually receives connections. If it is busy, the other 15 children do > nothing. > > I have spent a great deal of time on this, both reading docs and > experimenting. It seems that Satan himself has cursed this project. I tried > setting up the socket in the parent process like I did when I forked for each > connection. That did not work; apparently if the child is listening, it must > also setup the socket. > > I also tried running multiple CMD boxes each running a non-forking version of > the code, but only the first instance will receive and process connections. > > Is there some fundamental thing I'm missing about listening for connections, > like only one process can do it? Sorry about the long post- I thought more > background would be better than less. The pertinent parts of the code are > below: Have you tried doing it in one process without forking ? If you have to, you can store the messages in files and start BG processes (detached processes) to process them from the files. If the processing is minimal, I'd do it all from the single process. PS: I would never use fork on Win32. _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
