Acceptor and Connector patterns

Design Patterns for Actively and Passively
The Acceptor and Connector patterns decouple the passive and active establishment of a 
connection, respectively, from the service performed once the 
connection is established. In addition, the patterns decou� 
ple the service creation and concurrency strategies from the 
services themselves. 

Introduction 
Connection�oriented protocols (such as TCP/IP or IPX/SPX) 
provide reliable delivery of data between two or more end� 
points of communication. Establishing connections between 
endpoints involves the following two roles: 

Passive role -- which initializes an endpoint of commu� 
nication at a particular address and waits passively for 
the other endpoint(s) to connect with it; 

Active role -- which actively initiates a connection to one 
or more endpoints that are playing the passive role. 

The server plays the passive role and the client plays the active 
role. It is important to recognize that traditional distinctions 
between ``client'' and ``server'' refer to communication roles, 
not necessarily to connection roles. Although clients often 
take the active role in establishing connections with a passive 
server it is possible for the connection roles to be reversed, 

The intent of the Acceptor and Connector patterns de� 
scribed in this paper is to decouple the passive and active 
connection roles, respectively, from the services performed 
once a connection is established.

These patterns are motivated by the observation that the service processing per� 
formed between connected endpoints is often independent of 
the following: 

Which endpoint initiated the connection -- 

The network programming interfaces and underlying 
protocols used to establish the connection -- different 
network programming interfaces