
Michel André wrote:
Don G wrote:
The reason I suppose that I preferred not-yet-connected as a state of stream (vs. a separate class) is that it is logically a 1-to-1 relationship (and even the same socket) whereas acceptor is a 1-to-N relationship (the acceptor socket never becomes something else).
I don't see connector as 1 to 1 concept. You can use a connector to establish several connections to the same address or endpoint if that is needed. The connector pattern can be used to model fail over between different endpoints providing the same servcie, by having a service_connector implementation that wraps and coordinates several alternate connectors to different end points over potentially different transports. This also hides/abstracts the fail over strategy new endpoint selection in a nice way from the protocol handler and stream.
Ah, good to see Michel jumping in! :) I think the whole confusion really arises from that we talk about different parts of the network library but don't notice. In my opinion in level 0 connector has a 1:1-relationship with a connected socket while in level 1 it makes sense for the connector to behave as an acceptor and have a 1:n-relationship with connected service handlers. In level 0 experienced network developers would expect a 1:1-relationship (just as Don does) and in level 1 non-experienced network developers would expect the connector to behave as the acceptor (just as Michel does; that doesn't mean of course that I think Michel is a non-experienced network developer ;-). So both of you are right. What we have to do when we look at proposals like Don's library is to figure out what belongs to level 0, what belongs to level 1, what can be dropped and what is brand new we haven't thought about yet. While Don's connector belongs in a standard network library in level 0 I'd say that eg. address schemas like tcp:/www.example.com:80 definitely belong to level 1. My personal rule of thumb is: What Stevens wrote in "Unix Network Programming" is level 0, everything else is level 1. Boris
[...]