I'll see if I can find it, but this was a small proof of concept project I did years ago just to see if it was possible (Open multiple connections, then echo text typed in one to all the others), so it's probably in some archive in a deep corner of my backup drive.
More specifically, the program was actually multi-process, not multi-threaded. I remember abusing shared memory, and generally doing things that most would not associate with PHP in order to overcome the limitations of the language. I also recall that I had a busy loop for some reason, and that the server broke my networking if I didn't shut it down properly, though that was just me being lazy with connection management. These days I think they've implemented proper native threading in PHP, so I imagine you could do what I did back then with significantly less hackery.
1
u/TikiTDO Feb 24 '13 edited Feb 24 '13
I'll see if I can find it, but this was a small proof of concept project I did years ago just to see if it was possible (Open multiple connections, then echo text typed in one to all the others), so it's probably in some archive in a deep corner of my backup drive.
More specifically, the program was actually multi-process, not multi-threaded. I remember abusing shared memory, and generally doing things that most would not associate with PHP in order to overcome the limitations of the language. I also recall that I had a busy loop for some reason, and that the server broke my networking if I didn't shut it down properly, though that was just me being lazy with connection management. These days I think they've implemented proper native threading in PHP, so I imagine you could do what I did back then with significantly less hackery.