What i'm trying to leverage on is the socket that is left open. Since it is left open, i can write() to it, not from a php script necessarily, but another application. And since it is a custom client, i can have complete control over it.
Developing a multi-threaded or listening server using php is not something that i'm interested in. I was looking for a way where i could get the open socket from apache so that i could just write to it. And i know that a web server cannot respond without a request. I'm talking abt another application getting hold of the socket and sending data to the client that is read()ing from the socket at the other end. This is how a percieved full-duplex connection would be established using just one socket - the client can send in new requests over the connection which apache can hand off to php scripts to process, and the other application can use the socket to send asynchronous data to the client utilizing the fact that the connection is still open. All i'm asking for is a way to get the socket from apache. I know that there are no php functions to retrieve the socket on which apache is writing to the client, but want to know how it can be done. I'm not averse to writing some C code to get it done. Tx, Vinod. On Thu, 23 May 2002 Dave Mertens wrote : >On Thu, May 23, 2002 at 09:56:22AM -0000, Vinod Panicker >wrote: > > 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. >First, When a request is processed the processing-part of apache >(or other >webservers) are shutdown. Apache can only keep a connection open >when a >script doesn't reach the end. > >The client (can be telnet, a custom app or even a browser) >request a >resource from the server. The server response on this to send >data to the >client. When the data is send, the request is done and the >webserver goes >back into listening mode, but the connection isn't closed.. > >A web-server can never start a asynchroon connection with the >client. HTTP >is never meant for 2-way communication. It's a simple >request-response system. > >I believe that since php 4.2 php has a true socket interface. And >properbly >you can use the bind/accept procedures to create a php server. >With pcntl >you can fork the process. Because you now have full control over >the socket, you can also send >asynchroon data over the socket. In fact you have written you're >own >server.. > >I only don't know if php-sockets can handle multiple connections. >If not, >use can always create an socket-array, and assign the >socket-resource to a >free socket in the socket-array. But this is more the Visual >Basic way.. > >-- >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