Reply to Re: PHP & open connections

Your name:

Reply:


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]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация