Re: Multiple connections to an application process

George Feinberg (gmf@odi.com)
Wed, 24 Jul 1996 10:06:17 -0400 (EDT)

From: George Feinberg <gmf@odi.com>
Message-Id: <199607241406.KAA09098@loon.odi.com>
Subject: Re: Multiple connections to an application process
To: mbrown@OpenMarket.com (Mark Brown)
Date: Wed, 24 Jul 1996 10:06:17 -0400 (EDT)
In-Reply-To: <199607240052.UAA14816@breckenridge.openmarket.com>

> 
>     I got some code together that will one day allow me to have
>     connections to the multiple Apache server processes...
> 
>     The first thing it does is an SO_REUSEADDR on
>     FCGI_LISTENSOCK_FILENO...  and it gets errno=99 [EOPNOTSUPP]. On
>     investigation of the Apache fastcgi module I find that it is using
>     unix domain sockets [AF_UNIX] with file names of the form
>     /tmp/OM_WS_...
> 
>     1. How is reuseability meant to work with AF_UNIX sockets? If it
>     does at all!
> 
> I haven't tried it yet, but will try it soon as I test the
> multi-threaded library I am developing.  My guess is that the
> SO_REUSEADDR is simply not required in the Unix domain case, but I am
> not positive.

SO_REUSEADDR has no effect on Unix domain sockets on any implementation
I've seen.  Most of the time, though, it fails silently; occasionally,
it returns an error, so it's best to avoid it.  Unfortunately, I
know of no canned way to get Unix systems (Solaris, at least), to
get this right.  It seems to key off of the mere existence of the 
socket name, and ignores actual references, resulting in EADDRINUSE,
even if it's not.

George

> 
>     2. Must I make a version of the Apache module that uses AF_INET
>     sockets?
> 
> I don't think that will be necessary, at least not for the purposes
> of getting multiple connections to an application process.
> 
>     --mark
>