Here you go:

static int my_post_read_request(request_rec *r)
{
   conn_rec *conn = r->connection;
apr_socket_t *csd = ((core_net_rec *)conn->input_filters->ctx)->client_socket; ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "mod_my_download: client socket file descriptor: %d",csd->socketdes);
   return OK;
}


And now, the usual *use on your own risk*, though I know why you need it. We did almost the same thing + some fcntl, and sendfile. Good luck


Giovanni Donelli  wrote / napísal(a):
Hi!     I totally understand your concerns regarding working directly with
the socket file descriptor.

However the module I am working on needs to cooperate with an extension in
the kernel and I would like to pass small data from the kernel to the module
by using the getsockopt API.

As soon as you have have the source code with you please post it here!

Thank you very much!
Giovanni


On Nov 29, 2007 10:32 AM, bronto <[EMAIL PROTECTED]> wrote:

Hello,

I don't have access o my source code right now, but the mentioned method
is not one that I used (and mine worked).
I guess, in a day or two I will be able to get to my source, and send it
here.

But to mention, are you sure you need the socket file descriptor? Since
the api is done the way, that maybe 90% of modules actually don't need
to know the socket(and use buckets&brigades). There *are* situations
though, but think about it twice.

Regards,
Stefan

Giovanni Donelli  wrote / napísal(a):
I needed to:
#define CORE_PRIVATE
Sorry about that.

Anyway, this doesn't seem to be working. I'm logging the file
descriptor of different request_rec and the result is always the same,
(this can't be, right?).

Any other way to get the actual socket of a request_rec ?

Thanks!


On Nov 22, 2007 4:10 PM, Giovanni Donelli <[EMAIL PROTECTED]>
wrote:
Thank you very much,
      what is the core_module symbol referencing to? I can't compile
it without binding that to something.

Giovanni




On Nov 22, 2007 4:05 PM, Tamas Palagyi <[EMAIL PROTECTED]> wrote:

Try this:

struct apr_socket_t_internal {

    apr_pool_t *pool;
    int socketdes;
};

int getfd(request_rec *r) {

  conn_rec *c = r->connection;
  apr_socket_t *s = ap_get_module_config(c->conn_config,&core_module);
  struct apr_socket_t_internal *i = (struct apr_socket_t_internal *)
s;
  return i->socketdes;
}

I have seen somewhere some other way to get fd tough...

Tamas




On Thu, 2007-11-22 at 15:44 +0000, Giovanni Donelli wrote:

Dear fellow module developer,

     given a request_rec*r is there anyway to get to the actual
socket
file descriptor from which the request came in?

I have been struggling all day trying to get this info out of a
request_rec. Please help!

Thank you!
Giovanni



Reply via email to