I need to open 100+ outbound socket connections in PHP. But while that is happening I obviously need to maintain and read data from the sockets that are open. I looked at process control and fork but i don't want to have 100 processes running independently of each other. Thoughts?
My current implementation opens a socket and then reads from and maintains the other sockets that are open. But even a low timeout value on fsockopen() could cause data to excessively pile up in the socket buffers and cause packets to be dropped.
PHP doesn't support threading, so I don't think you will be able to do what you want there. You could possibly use a language that supports threading, or break it up into bits and do only a few connections per job.