RE: [PHP-DEV] Re: Client socket
| From: | Vinod Panicker | Date: | Thu, 30 May 2002 05:45:55 +0000 |
| Subject: | RE: [PHP-DEV] Re: Client socket | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-84566@lists.php.net to get a copy of this message | ||
Makes sense. Dunno why it didn't occur to me before - the '3' says it
all.
I need the actual socket - which when written to will send data to the
client. Is it there in the request_rec structure?
Or can I get it some other way?
Tx,
Vinod.
-----------------------------------
Vinod Panicker <vinod@geodesiconline.com>
Sr. Software Designer
Geodesic Information Systems Ltd.
-----Original Message-----
From: J Smith [mailto:dark_panda@hushmail.com]
Sent: Wednesday, May 29, 2002 8:13 PM
To: php-dev@lists.php.net
Subject: [PHP-DEV] Re: Client socket
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.
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php