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. Link to comment https://forums.phpfreaks.com/topic/143406-multithreaded-socket-server/ 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. Link to comment https://forums.phpfreaks.com/topic/143406-multithreaded-socket-server/#findComment-752238 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 Link to comment https://forums.phpfreaks.com/topic/143406-multithreaded-socket-server/#findComment-752247 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... Link to comment https://forums.phpfreaks.com/topic/143406-multithreaded-socket-server/#findComment-752279 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.