Hi Dave,

Thanks for the suggestion.  But i really dont wanna go in for an 
infinite loop - just a hopeless waste of resources.  I didnt say 
that a Keep-Alive connection would mean a Full-Duplex connection - 
i know how keep-alive works, as well as HTTP.  I know HTTP is 
based on a request-response model, and the server cannot send any 
data to the client without the client requesting for the data 
first.

But what i want is the socket which is used by Apache to send data 
to the client, which is on a keep-alive connection, so that some 
other program, or a php script can send data asynchronously to the 
client.  mind you, the client is a custom developed COM component, 
not a browser.

So what i was asking for was a means to make the connection a 
Full-Duplex one, by taking the socket from apache and using it 
elsewhere.  The Keep-alive timeouts can be configured at either 
ends since the web server is only going to be accessed by these 
clients.

Tx,
Vinod.

On Wed, 22 May 2002 Dave Mertens wrote :
>On Wed, May 22, 2002 at 10:16:23AM -0000, Vinod  Panicker 
>wrote:
> > The client calls a script on the server - script_a.php using 
>a
> > keep-alive connection.  The script gets the socket from the 
>web
> > server (this is the unknown), and stores it in a database.  
>Script
> > finishes execution, client reads response, but apache doesnt 
>close
> > the connection since its keep-alive.
> >
> > Client wants to call another script on the server, just writes 
>to
> > the same socket.  Script returns response.
> >
> > Server wants to send data asynchronously to the client, so a 
>PHP
> > script (invoked from another server) gets the socket of the 
>client
> >  from the database and writes to it.  Client reads from the
> > socket.
> >
> > So this is basically a full-duplex connection over HTTP :)
>Not quite!
>
>Keep-alive tries to keep a socket connection with the server, but 
>this connection
>can only be used to request several resources from the servers 
>(like the
>images inside a page). This because setting up a new 
>tcp-connection takes a lot
>of time, keep-alive just reuse this connection for another 
>request. The server itself cannot
>*start* sending data over the http connection, it can only reply 
>on a client request.
>
>What you can do however, is to create a script with an endless 
>loop, inside
>this loop the scripts looks if there's new data in a database and 
>if there's
>data, it's sent to the client.. You can ofcourse also do other 
>things inside
>the loop.
>
>But you won't need a keep-alive connection for this. Ohh, don't 
>use any out
>buffering, otherwise the browser will timeout after 30 seconds..  
>;-)
>
>However the server can't switch pages. What you can do, is inside 
>the loop
>to access a different page with the fopen function.
>
>Hope this will answer your question,
>
>--
>With best regards,
>
>Dave Mertens, Development Manager
>[EMAIL PROTECTED]
>
>Innovative Solutions in Media BV
>Schiekade 101
>3033 BG  Rotterdam, Netherlands
>Tel. +31-10-2436060
>Fax. +31-10-2436066

_________________________________________________________
Click below to visit monsterindia.com and review jobs in India or 
Abroad
http://monsterindia.rediff.com/jobs


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to