Hi Jeff,

Thanks for your reply...

Let me explain what exactly I did.

I made changes to the php_apache.c file and added a new php function of
my own, which is supposed to return the client socket when called from a
php script.  Here is the code for the function - 

---------------

/* {{{ proto int apache_client_socket()
   Get the client socket */
PHP_FUNCTION(apache_client_socket)
{
        RETURN_LONG(((request_rec
*)SG(server_context))->connection->client->fd);
}

---------------

I recompiled php and made a module out of it.  Worked perfectly.  Now, I
wrote a php script with the following code - 

---------------
<?
        echo apache_client_socket();
?>
---------------

This script I call from the browser, and everytime it displays a '3'.  I
even called it from different browser windows, still the same.

That cant be alright since if the fd is 3 as shown in one browser
window, it has to be something different in the other window since the
browser defaults to a keep-alive connection, and the fd's have to be
different.

I'll would tell you why I need the socket, but I've described it so many
times that I'm gonna die :(  I'll forward you a mail if you are really
interested.

Tx,
Vinod.

-----------------------------------
Vinod Panicker <[EMAIL PROTECTED]>
Sr. Software Designer
Geodesic Information Systems Ltd. 



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Jeff Trawick
Sent: Wednesday, May 29, 2002 4:19 PM
To: [EMAIL PROTECTED]
Subject: Re: Client socket


"Vinod Panicker" <[EMAIL PROTECTED]> writes:

> Hi,
> 
> Where is the client socket fd stored in the request_rec structure?
> 
> Is it either of the r->connection->client->fd or the
> r->connection->client->fd_in variables?
> 
> I tried accessing the values, but both the variables show the value 
> '3' for every request passed to the php module.

Why is 3 incorrect?  Did you do lsof on your httpd process while stopped
in the debugger to verify that 3 is (or is not) the connection to the
client?

Why do you need access to the socket?

-- 
Jeff Trawick | [EMAIL PROTECTED]
Born in Roswell... married an alien...

Reply via email to