This comment is only on the heuristic:
One possible heuristic for distinguishing these cases is to assume
that an application that invokes a passive open (as its first
network usage) is a server, while an application that first invokes
an active open be assumed to be a client.
My first reaction is that this heuristic is significantly flawed.
The mapping between "application" and OS-visible objects
(process/program) may not be 1:1; in particular, consider inetd on
most unix systems -- common infrastructure code does the passive open,
and the application isn't started until after the connection is
established.
Even in the case of single-process applications, the server may invoke
some library routine during initialization might do an
under-the-covers active open (e.g., getpwuid() or gethostbyaddr() to
get a character string user or host name for a log entry).
What's more, in the case of TCP, it's largely pointless -- TCP passive
opens do not require source address selection at all. The networking
API's I'm familiar with typically allow an application to open a port
with wildcarded local address, or to specify the local address in
addition to the port. In the former case, the peer picks the local
address and it "sticks" for the life of the connection.
In the case of datagram sockets (where there isn't a passive/active
distinction), it might make sense to prefer permanent addresses if the
first activity was the receipt of a packet.
- Bill
--------------------------------------------------------------------
IETF IPng Working Group Mailing List
IPng Home Page: http://playground.sun.com/ipng
FTP archive: ftp://playground.sun.com/pub/ipng
Direct all administrative requests to [EMAIL PROTECTED]
--------------------------------------------------------------------