Hi,

I am deveoping a chatserver in IRC-style in PHP. For communication it uses
socket-multiplexing aka socket_select. So long so good, works perfectly.
The problem is, than when i make several socket_write's to the same client
without waiting about 0.1sec after each write, the written data gets lost
somewhere. socket_write does NOT throw any error, the data seams just
sended, but the clients never receives it.

Small example of the used code:
-----
var $clients // array of 'client'-objects, each object has it's own
socket-descriptor in the object-variable $socket

function write_to_clients ($text) {
  for ($i = 0; $i < count ($this->clients); $i++) {
    socket_write ($this->clients[$i]->socket, $text);
  }
  // usleep (10000); if this is uncommented, all write are received by all
clients
}

for ($i = 0; $i < 10; $i++) {
    $this->write_to_clients ("test ".$i);
}
-----

Okay, this doesn't check the client-sockets for readiness to write, but even
if I check (via socket_select), ALL clients are ready to write and writes
get lost too. It can't be the network-connection, because the tests run with
standalone PHP-clients on the same machine.

Is there any possibility to make fast writes without waiting after each
write? The wait limits the server to max. 10 writes per second, wich isn't
really enaugh for a good chatserver.

Thanks for your help!

Thomas 'Neo' Weber
---
[EMAIL PROTECTED]
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to