Example #1
0
 /// <summary>
 /// Initializes a new channel instance
 /// </summary>
 /// <param name="manager">
 /// Containing channel listener/factory
 /// </param>
 /// <param name="session">
 /// The current in-process session
 /// </param>
 /// <param name="address">
 /// The server communication address
 /// </param>
 public Channel(
     ChannelManagerBase manager,
     Session session,
     EndpointAddress address)
     : base(manager, null, address, address)
 {
     this.session = session;
 }
Example #2
0
 /// <summary>
 /// Establishes a new in-process session
 /// </summary>
 /// <param name="address">
 /// The server address to connect
 /// </param>
 /// <returns>
 /// The client end of the session
 /// </returns>
 public static Session Connect(EndpointAddress address)
 {
     // retrieve a listener for the specified address
      Listener listener;
      if (!listeners.TryGetValue(address.Uri, out listener))
     throw new InvalidOperationException(
        String.Format("No listener found for address {0}", address.Uri)
     );
      // establish the new server and client session
      Session session = new Session();
      listener.Accept(session);
      return session.Connect();
 }
Example #3
0
 /// <summary>
 /// Connects a client endpoint to the current
 /// server session
 /// </summary>
 /// <returns>
 /// The client side of the current session
 /// </returns>
 public Session Connect()
 {
     if (this.completer != null)
     throw new InvalidOperationException("The current session is already connected.");
      Session other = new Session(
     this.id,
     this.outputMessageQueue,
     this.inputMessageQueue,
     this.outputCallbackQueue,
     this.inputCallbackQueue
      );
      this.completer = () => other.isComplete = true;
      other.completer = () => this.isComplete = true;
      return other;
 }