mmmuppet Posted February 1, 2009 Share Posted February 1, 2009 I would like to make a muiltithreaded socket server. I've made one which accepts one client and reads/writes data but I'm not sure how to achieve the 'multithreaded' effect. Any pointers, no matter how small or seemingly obvious, will be gratefully received. Quote Link to comment Share on other sites More sharing options...
corbin Posted February 1, 2009 Share Posted February 1, 2009 PHP is single threaded. I've seen hacks to try to make it multithreaded, but none of them were good. Go with something like Java or C++ (I like the Boost Thread library, but I haven't used it much). Or, I hear Python supports multiple threads (I might have dreamed that). Edit: http://php.net/pcntl_fork I'm not sure quite how that works... I don't know if it's parallel execution or the CPU just alternates. If it forks into a second process like the manual page says, you might be able to "multithread" with it. (You would need to share variables though, and I'm not sure if variables are kept.) I'm about to test it now. Quote Link to comment Share on other sites More sharing options...
corbin Posted February 1, 2009 Share Posted February 1, 2009 Bah can't edit... http://webforumz.com/php-forum/12595-multithreaded-php.htm Quote Link to comment Share on other sites More sharing options...
printf Posted February 2, 2009 Share Posted February 2, 2009 Just go over to pear and get Net_Server Or go here and download it with 3 good examples... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.