On Wed, Aug 18, 2004 at 12:59:51PM -0700, Ken Simpson wrote: > > the APR::Socket object is an opaque one, so it can't interoperate with any > > other perl modules. Have you looked if there is some C api to get the > > native socket object? There could be one (as they have for file objects), > > I didn't check. > > I looked through apr_network_io.h, which seemed like the logical > place, and couldn't find an API that returns the native socket > object. But I'm pretty unfamiliar with the Apache code base, so > someone else would probably have better luck.
This is what we'd need bound to the Perl API: apr_os_sock_t fd; apr_os_sock_get((apr_os_sock_t *) &fd, (apr_socket_t *) client_socket); On Unix-type platforms, apr_os_sock_t is an int -- the file descriptor, which you can use with select() or IO::Select() or anything you like in Perl to poll the descriptor: $rin = ''; vec($rin, $fd) = 1; ## $fd directly instead of fileno(STDIN) or fileno($FH) ... $nfound = select($rout=$rin, undef, undef, $timeout); (On other platforms, like Windows, I don't know what apr_os_sock_t is; check the headers files. :) To get the client socket for a connection, you can obtain the (apr_socket_t *) with the incantation: apr_socket_t *client_socket = ap_get_module_config(r->connection->conn_config, &core_module); and then use apr_os_sock_get() to get the fd. Cheers, Glenn -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html