RE: [PHP-DEV] Re: Client socket

2002-05-30 Thread J Smith


I'm no apache expert when it comes to hacking the source or anything, but it 
appears that ap_rwrite() and ap_write() might do what you're looking for. 
They look something like this:

int ap_rwrite(const void *buf, int nbyte, request_rec *r);

And apparently they let you write directly to the request. Or something like 
that. 

J



Vinod Panicker wrote:

 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 [EMAIL PROTECTED]
 Sr. Software Designer
 Geodesic Information Systems Ltd.
 
 
 
 -Original Message-
 From: J Smith [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 29, 2002 8:13 PM
 To: [EMAIL PROTECTED]
 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
 
 


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




RE: [PHP-DEV] Re: Client socket

2002-05-29 Thread Vinod Panicker

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 [EMAIL PROTECTED]
Sr. Software Designer
Geodesic Information Systems Ltd. 



-Original Message-
From: J Smith [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, May 29, 2002 8:13 PM
To: [EMAIL PROTECTED]
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 [EMAIL PROTECTED]
 Sr. Software Designer
 Geodesic Information Systems Ltd.


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


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