title: How does in duplex system WCF differentiate between different channel instances?
body: <p>Uhm, I’m utterly lost so any help would be much appreciated</p>
  
  <blockquote>
    <p>The
    OperationContext.Current.InstanceContext
    is the context of the current service
    instance that the incoming channel is
    using.</p>
    
    <p>In a Duplex system, the service can
    callback to the client via a
    CallbackContract.  This
    CallbackContract is much like a
    service on the client side that is
    listening for calls from the service
    on the channel that the client has
    opened.  This “client callback
    service” can only be accessed via the
    same channel it used on the service
    and therefore only that service has
    access to it.</p>
  </blockquote>
  
  <p>a) So in duplex systems the same channel instance with which client-side sends messages to the service, is also used by client to receive messages from the service? </p>
  
  <p>b) If in request-reply system a client uses particular channel instance <code>clientChannel</code> to send a message to the service, then I assume this same instance ( thus <code>clientChannel</code> ) needs to stay opened until service sends back a reply to this instance, while in duplex system <code>clientChannel</code> needs to stay opened until the session is closed?</p>
  
  <p>c) I’m assuming such behaviour since as far as I can tell  each channel instance has a unique address ( or ID ) which helps to differentiate it from other channel instances ) running on the same client? And when service sends back a message, it also specifies an ID of this channel? </p>
  
  <p>Thus when in Duplex system client calls a service, WCF creates ( on client side ) a channel instance <code>clientChannel</code>, which sends a  message over the wire. On server’s side WCF creates channel instance <code>serverChannel</code>, which delivers the message to requested operation(method). When this method wants to callback to the client via <code>CallbackContract</code>, it uses <code>InstanceContext.GetCallBackChannel&lt;&gt;</code> to create a channel, which among other things contains the ID of the channel that called a service ( thus it contains an exact address or ID of <code>clientChannel</code> )?</p>
  
  <p>d) Does in duplex systems client use the same channel instance to call any of endpoint’s operations? </p>
  
  <p>Thank you</p>