1.2.4 Client, Servers, and Roles
|For Standard||ETP v1.1|
Consistent with all TCP communication, ETP includes the fundamental roles of client and server. That is, in all ETP communication, one agent must be a server that is listening on a TCP port, and one agent must be a client that begins by connecting on that address and port. However, beyond these basic roles, the general direction of information flow is independent of this client/server relationship. This scenario is a business requirement for WITSML.
To accommodate this requirement, each subprotocol in ETP defines a set of roles that are appropriate for that protocol. The assignment of these roles to agents happens as a part of the Core protocol (Protocol 0). In general, the client begins by telling the server which subprotocols it wants to use and the named roles it wants the server to fulfill in this session. The server then responds to indicate it is able to fulfill its role; if it cannot, it sends an exception message to client. This “client-goes-first” logic is predicated on the basis that a client knows why it is connecting to a server; whereas, a server that is capable of supporting two different roles has no way of knowing which one the client wants to use.
For a more concrete example: The ChannelStreaming protocol (Protocol 1) defines two roles: producer and consumer. Each agent is either a producer or a consumer of streaming data. Simplistically, we could say that a measurement device or rig aggregator is usually a producer; a service company WITSML store can be a either a producer or a consumer, and a Web browser or desktop client is usually only a consumer. The connection from aggregator to store is of most interest. Either agent could be the client, but on connecting, the store client would ask to be a consumer of data, and the aggregator as client would ask to be a producer.