IMAP? We were talking about IRC, the Internet Relay Chat.
In detail, my problems doesn't even refer to IRC directly, as i am
developing a server for a html-based webchat, but the server-structure and
the messages are nearly the same.
Once you realize the basics of socket-multicasting, it is no problem to
maintain hundreds of simultanous TCP-connects via arrays of sockets, also
called descriptor-sets. PHP seems to directly use the underlying C-
libraries, so everything you can imagine is possible.
Anyway, the major drawback of PHP in this case is speed. Currently i can
send about seven messages per second (one send means socket-connect of a
input client, some simple processing of the message and sending it to all
connected listening clients) with a dozen listening clients, but only about
three messages per second with two hundred listening clients. As C-written
IRC-servers sometimes have thousands of connected clients, i can only
imagine that it is PHP which has some not so efficent array- or
resource-handling.

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

----- Original Message ----- 
From: "Raditha Dissanayake" <[EMAIL PROTECTED]>
Cc: "PHP-List" <[EMAIL PROTECTED]>
Sent: Sunday, September 14, 2003 7:26 AM
Subject: Re: [PHP] socket_write eats data - solved


> Wouldn't this multiple connections be a problem for php? IMHO one of the
> main draw backs of the PHP IMAP library is the fact that you have to
> open and close and imap connection for each page. That issue is
> multiplied ten fold in this scenario isn't it?
>
>
> Thomas Weber wrote:
>
> >No, it's TCP and a very uncomplicated protocol, everything is sent in
clear
> >text. Major problem is the socket-multicasting to keep track of all
clients
> >simultanly.
> >
> >----- Original Message ----- 
> >From: "Raditha Dissanayake" <[EMAIL PROTECTED]>
> >To: "Thomas Weber" <[EMAIL PROTECTED]>; "PHP-List"
> ><[EMAIL PROTECTED]>
> >Sent: Sunday, September 14, 2003 2:59 AM
> >Subject: Re: [PHP] socket_write eats data - solved
> >
> >
> >
> >
> >>Is IRC UDP?
> >>Thomas Weber wrote:
> >>
> >>
> >>
> >>>Hi,
> >>>
> >>>i've checked a hundred things before posting this question, but i
forgot
> >>>
> >>>
> >the
> >
> >
> >>>most important thing, the buffer.
> >>>The 'eaten' writes were buffered by the network-kernel and sent as
bunch
> >>>
> >>>
> >of
> >
> >
> >>>data. If too much data for the buffer is sent, the write is broken up
and
> >>>completed in the next bunch-of-data.
> >>>My receive-script hasn't diplayed the raw output, but an unserialized
> >>>
> >>>
> >array,
> >
> >
> >>>fetched out of the received string.
> >>>
> >>>Maybe this will will help someone in future.
> >>>
> >>>Thomas 'Neo' Weber
> >>>---
> >>>[EMAIL PROTECTED]
> >>>[EMAIL PROTECTED]
> >>>
> >>>----- Original Message ----- 
> >>>From: "Thomas Weber" <[EMAIL PROTECTED]>
> >>>To: "PHP-List" <[EMAIL PROTECTED]>
> >>>Sent: Saturday, September 13, 2003 9:15 PM
> >>>Subject: [PHP] socket_write eats data
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>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
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>-- 
> >>http://www.radinks.com/upload
> >>Drag and Drop File Uploader.
> >>
> >>-- 
> >>PHP General Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >>
> >
> >
> >
>
>
> -- 
> http://www.radinks.com/upload
> Drag and Drop File Uploader.
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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

Reply via email to