You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
is the example testwebsock.php multi threaded ?
you need the pthread posix dll for php on windows in order to enable threads ?
I don't think so because it should have
extends Thread
client->start()
client->join() to wait for thread exit if needed
such as this pthread example
<?php
/*
* Please don't use resources, it's dangerous ...
*/
class Test extends Thread {
public $stop = false;
public function __construct($socket){
$this->socket = $socket;
}
public function run(){
while(++$clients < 10 &&
($client = socket_accept($this->socket))){
printf("Accept in %lu\n", $this->getThreadId());
var_dump($client);
var_dump($this->socket);
socket_close($client);
}
}
}
$workers = array();
$sock = socket_create_listen($argv[1]);
if ($sock) {
while(++$worker<5){
$workers[$worker] = new Test($sock);
$workers[$worker]->start();
}
printf("%d threads waiting on port %d\n", count($workers), $argv[1]);
}
foreach ($workers as $thread)
$thread->join();
?>
possibily could you post a multi thread version of testwebsock.php please
I think that example is single threaded, and handles receive in process() for each user, round robin, I enclose an example where also the transmit in tick() is called round robin for each user with per client requested data from a mongo db in case you wish to make a similar multiple client example please
possibily could you post a multi thread version of testwebsock.php please
If someone wants to develop this feature, I'll be happy to review and merge
what they have.
Anyone who does want to develop this feature, please keep in mind that one
of my goals is to keep extension dependencies to a minimum, so if pthreads
is not available, it should fall back gracefully.
I, personally, will not be doing new development on the GitHub version (and
my planned GitLab hosted version is not expected to be compatible with this
version here). (Honestly, the longer I can go without logging in to
GitHub, and just responding to bugs through email replies, the happier I'll
be.)
On Fri, Oct 25, 2019 at 10:24 AM gfanini ***@***.***> wrote:
is the example testwebsock.php multi threaded ?
you need the pthread posix dll for php on windows in order to enable
threads ?
I don't think so because it should have
extends Thread
client->start()
client->join() to wait for thread exit if needed
such as this pthread example
socket = $socket; } public function run(){ while(++$clients < 10 &&
($client = socket_accept($this->socket))){ printf("Accept in %lu\n",
$this->getThreadId()); var_dump($client); var_dump($this->socket);
socket_close($client); } } } $workers = array(); $sock =
socket_create_listen($argv[1]); if ($sock) { while(++$worker<5){
$workers[$worker] = new Test($sock); $workers[$worker]->start(); }
printf("%d threads waiting on port %d\n", count($workers), $argv[1]); }
foreach ($workers as $thread) $thread->join(); ?>
possibily could you post a multi thread version of testwebsock.php please
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#124?email_source=notifications&email_token=AAB46PTZUX6RSMD6NEHJTTLQQMTTBA5CNFSM4JFF6HT2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HUODV7A>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAB46PTQFD76ZK54GOD6HI3QQMTTBANCNFSM4JFF6HTQ>
.
is the example testwebsock.php multi threaded ?
you need the pthread posix dll for php on windows in order to enable threads ?
I don't think so because it should have
extends Thread
client->start()
client->join() to wait for thread exit if needed
such as this pthread example
possibily could you post a multi thread version of testwebsock.php please
I think that example is single threaded, and handles receive in process() for each user, round robin, I enclose an example where also the transmit in tick() is called round robin for each user with per client requested data from a mongo db in case you wish to make a similar multiple client example please
www.zip
The text was updated successfully, but these errors were encountered: