Re: Client socket
| From: | J Smith | Date: | Wed, 29 May 2002 14:43:01 +0000 |
| Subject: | Re: Client socket | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-84525@lists.php.net to get a copy of this message | ||
Since apache is multi-processed rather than multi-threaded, I'd imagine that
you're getting the same socket file descriptor since each new connection
means a new fork of httpd, resulting in three file descriptors by the time
you get to what you're doing.
Are you trying to get ahold of the socket/port number itself? Or connect to
the actual socket?
J
Vinod Panicker wrote:
> Hi,
>
> Continuing with the problem that I've been having...
>
> 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 <vinod@mundu.com>
> Sr. Software Designer
> Geodesic Information Systems Ltd.