Hi, I need to transfer the socket descriptor for a client connection from the Apache httpd process to a non-httpd process running on the same system as Apache httpd, thus transferring the server response responsibility from Apache httpd to the non-httpd process (i.e., the Apache httpd process must not reply anything to the client).
The way I need to do this is due to legacy code and I need to implement it in C. I've tried writing a module that uses ap_hook_pre_connection(...) where I then send the socket descriptor via sendmsg(...) with something like this: static int fdipc_pre_connection(conn_rec *c, void *csd) { apr_os_sock_t sock; apr_os_sock_get(&sock, csd); ... sendmsg(...); ... return DONE; } static void fdipc_register_hooks(apr_pool_t *p) { ap_hook_pre_connection(fdipc_pre_connection, NULL, NULL, APR_HOOK_MIDDLE); } I've tried writing data to the socket directly after my non-httpd daemon process receives the socket descriptor and this results in that the client receives this data. However, very shortly afterwards the connections is closed and I'm not able to write to the socket anymore. Is this the right way to transfer the socket descriptor to a non-httpd daemon process? If so, what am I missing in order to make it work? Thanks in advance. Best Regards, Henrik