|
Posted by Kimmo Laine on 10/03/06 11:07
"Lenard Redwood" <freakingcrazy@gmail.com> wrote in message
news:1159809523.767613.115970@m73g2000cwd.googlegroups.com...
> Jerry Stuckle wrote:
>> You can't. HTTP is a pull only protocol. You can use javascript on the
>> client to pull the info on a regular basis (i.e. every 30 seconds). But
>> you can't push the data out.
>
> Exactly, actually each time user A writes a message and hits "Enter" it
> is sent right away to the server. But how can this message be thrown
> into the open connection that user B is using?
> Thanks,
Shared Memory Functions
http://fi.php.net/manual/en/ref.shmop.php
Both clients share a memoryblock where messages are read and written. You
might need of course some sort of locking system. When recieving the
message, the script tries to set it's semaphore in the memoryblock, then
test if it got it, then write to it, then release the semaphore and raise a
flag indicating that there is a new message waiting for the other
participant.
Both connections should be kept alive all the time, sending empty spaces
every now and then should keep it alive. Time-outing must be disabled of
course. I think it could work. It would be fun to develope. I've never used
shmop thou, so I might be wrong, but that's the closest thing php has to
"threads" AFAIK.
--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti pδivittyvδ nettisarjis
spam@outolempi.net || Gedoon-S @ IRCnet || rot13(xvzzb@bhgbyrzcv.arg)
[Back to original message]
|