On 25/06/13 08:43, jimmy frasche wrote:
On Mon, Jun 24, 2013 at 10:19 PM, Martin Sustrik<sustrik@xxxxxxxxxx> wrote:In other words, if you want a protocol that's similar to PUB/SUB but differs slightly from it, define a new SP protocol with different protocol ID. Internally, you can of course re-use the PUB/SUB implementation if you find that useful.I was imagining a protocol that could support SUB as a subset, as a separate explicit mode, say to handle older clients, so when it gets a SUB trying to attach it attaches it in backwards compatibility mode so as far as it knows it's connected to a PUB. Maybe I'm overthinking it.
In my thinking protocol is a full specification of the distributed algorithm including all the behaviours of individual node types. If behaviour of one node type (say SUB) changes it is a different protocol.
That being said, there's an different issue of automatic protocol version negotiation. So, for example, PUB socket speaks protocol v1 and v2, SUB socket speaks protocol v2. When the two get connected, they find out that v2 is the only one in common and choose that one to use.
The problem with that is that if protocol version changes, the semantics change. Thus, switching automagically from one version to another could break applications. The only exception here is when the new version has exactly the same semantics but different performance characteristics. But that's rather rare case IMO.
You'll have the same problem with textual names. The words that make sense as socket types are rather limited in number so you are going to get clashes. In either case you need a central authority to keep the list of existing protocols/socket types. The obvious choice for that is IANA. (See, e.g. the list of TCP ports managed by IANA.) Till then we can just keep the table on the web page somewhere.You have the same problems, just less of them and they're easier to resolve--or at least less irksome. I just worry it gets messy with multiple 3rd party protocols with multiple versions. There are only so many useful protocols and simple enough that few versions will be needed so perhaps I'm imagining problems.
Well, TCP have done OK till now with 2^16 port numbers (a.k.a. "services"). Based on that, I would assume SPs will with it as well.
I think there's an "endpoint" object missing. So, when you do "nn_bind ("tcp://127.0.0.1:5555") an endpoint is created, which, itself, has a list of connections.That's what I was referring to as network connections, but maybe I'm misunderstanding something.
One nn_bind() call can result in arbitrary number of simultaneous connections. One nn_connect() call can result in <0,1> simultaneous connections. That's why it is useful to have a three level hierarchy: socket, endpoint, connection.
Martin