You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Robert Andersson <ro...@profundis.nu> on 2003/10/01 10:11:51 UTC

Re: [users@httpd] apache 2 and socket connection

Michiels Olivier wrote:
> The connection is well made but when I start more than 1 instance of my
> module (in the prefork directive the StartServer is set to 2 for example)
the
> same socket descriptor is assigned to the apr_socket_t.

In which hook do you create the socket? Are you using apr_socket_create() to
create it?

Regards,
Robert Andersson


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] apache 2 and socket connection

Posted by Robert Andersson <ro...@profundis.nu>.
Michiels Olivier wrote:
> I've tried to display the sock->socketdes but my compiler says that the
sock
> data structure is an incomplete type.

Ah, yes, so it is. You can probably get the complete type if you include
"apr_arch_networkio.h" or "arch/(unix|win32|beos|...)/apr_arch_networkio.h".

How do you know that the two processes get the same socket descriptor?

I'm no expert on Apache internals, or the APR, so you might be better of
asking on either's development list.

Regards,
Robert Andersson


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] apache 2 and socket connection

Posted by Robert Andersson <ro...@profundis.nu>.
Michiels Olivier wrote:
> yes, i'm using the apr_socket_create.

The more important question was in what hook you create it: post_config(),
open_logs(), child_init()? What pool are you using?

> I've tried to compile apache with the different mpm options without
success.
> What is strange it is working with a secure socket but not with a non
secure socket.

If I understand your situation correctly, at some point in your code you
have an apr_socket_create() call. When this is called in the second process,
it gives back the same socket descriptor as it does in the first process,
right?

Something like this might be helpful, if that isn't exactly what you do to
find out ;)

apr_socket_t *sock;
if(apr_socket_create(&sock, APR_INET, SOCK_STREAM, p) == APR_SUCCESS) {
    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
        "Child %" APR_PID_T_FMT " created socket %i", getpid(),
sock->socketdes);
}

Regards,
Robert Andersson


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org