internal static IListenerBinder GetBinder(IChannelListener listener, MessageVersion messageVersion) { IChannelListener<IInputChannel> listener2 = listener as IChannelListener<IInputChannel>; if (listener2 != null) { return new InputListenerBinder(listener2, messageVersion); } IChannelListener<IInputSessionChannel> listener3 = listener as IChannelListener<IInputSessionChannel>; if (listener3 != null) { return new InputSessionListenerBinder(listener3, messageVersion); } IChannelListener<IReplyChannel> listener4 = listener as IChannelListener<IReplyChannel>; if (listener4 != null) { return new ReplyListenerBinder(listener4, messageVersion); } IChannelListener<IReplySessionChannel> listener5 = listener as IChannelListener<IReplySessionChannel>; if (listener5 != null) { return new ReplySessionListenerBinder(listener5, messageVersion); } IChannelListener<IDuplexChannel> listener6 = listener as IChannelListener<IDuplexChannel>; if (listener6 != null) { return new DuplexListenerBinder(listener6, messageVersion); } IChannelListener<IDuplexSessionChannel> listener7 = listener as IChannelListener<IDuplexSessionChannel>; if (listener7 == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("UnknownListenerType1", new object[] { listener.Uri.AbsoluteUri }))); } return new DuplexSessionListenerBinder(listener7, messageVersion); }
/// <summary> /// Creates a new <see cref="IDeviceListener"/> instance. /// </summary> /// <param name="channelListener">The channel listener that will be used to listen for events.</param> /// <returns>A new <see cref="IDeviceListener"/> instance.</returns> /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="channelListener"/> is <c>null</c>.</exception> public static IDeviceListener Create(IChannelListener channelListener) { Contract.Requires<ArgumentNullException>(channelListener != null, "channelListener"); Contract.Ensures(Contract.Result<IDeviceListener>() != null); return new DeviceListener(channelListener); }
public void Open() { HttpBinding binding = new HttpBinding(); this.ChannelListener = binding.BuildChannelListener<IReplyChannel>(this.BaseAddress); this.ChannelListener.Open(); IReplyChannel channnel = this.ChannelListener.AcceptChannel(); channnel.Open(); while (true) { RequestContext requestContext = channnel.ReceiveRequest(TimeSpan.MaxValue); Message message = requestContext.RequestMessage; MethodInfo method = message.GetType().GetMethod("GetHttpRequestMessage"); HttpRequestMessage request = (HttpRequestMessage)method.Invoke(message, new object[] { true }); Task<HttpResponseMessage> processResponse = base.SendAsync(request, new CancellationTokenSource().Token); processResponse.ContinueWith(task => { string httpMessageTypeName = "System.Web.Http.SelfHost.Channels.HttpMessage, System.Web.Http.SelfHost"; Type httpMessageType = Type.GetType(httpMessageTypeName); Message reply = (Message)Activator.CreateInstance(httpMessageType, new object[] { task.Result }); requestContext.Reply(reply); }); } }
internal static IListenerBinder GetBinder(IChannelListener listener, MessageVersion messageVersion) { IChannelListener<IInputChannel> input = listener as IChannelListener<IInputChannel>; if (input != null) return new InputListenerBinder(input, messageVersion); IChannelListener<IInputSessionChannel> inputSession = listener as IChannelListener<IInputSessionChannel>; if (inputSession != null) return new InputSessionListenerBinder(inputSession, messageVersion); IChannelListener<IReplyChannel> reply = listener as IChannelListener<IReplyChannel>; if (reply != null) return new ReplyListenerBinder(reply, messageVersion); IChannelListener<IReplySessionChannel> replySession = listener as IChannelListener<IReplySessionChannel>; if (replySession != null) return new ReplySessionListenerBinder(replySession, messageVersion); IChannelListener<IDuplexChannel> duplex = listener as IChannelListener<IDuplexChannel>; if (duplex != null) return new DuplexListenerBinder(duplex, messageVersion); IChannelListener<IDuplexSessionChannel> duplexSession = listener as IChannelListener<IDuplexSessionChannel>; if (duplexSession != null) return new DuplexSessionListenerBinder(duplexSession, messageVersion); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.UnknownListenerType1, listener.Uri.AbsoluteUri))); }
private static Task<IDuplexSessionChannel> AcceptChannelAsync(IChannelListener<IDuplexSessionChannel> listener) { return Task.Factory.FromAsync( (c, s) => ((IChannelListener<IDuplexSessionChannel>)s).BeginAcceptChannel(c, s), r => ((IChannelListener<IDuplexSessionChannel>)r.AsyncState).EndAcceptChannel(r), listener); }
/// <summary> /// Initializes a new instance of the <see cref="DeviceListener"/> class. /// </summary> /// <param name="channelListener">The channel listener.</param> /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="channelListener"/> is <c>null</c>.</exception> protected DeviceListener(IChannelListener channelListener) { Contract.Requires<ArgumentNullException>(channelListener != null, "channelListener"); _channelListener = channelListener; _channelListener.EventReceived += Channel_EventReceived; }
public SecurityListenerSettingsLifetimeManager(SecurityProtocolFactory securityProtocolFactory, SecuritySessionServerSettings sessionSettings, bool sessionMode, IChannelListener innerListener) { this.securityProtocolFactory = securityProtocolFactory; this.sessionSettings = sessionSettings; this.sessionMode = sessionMode; this.innerListener = innerListener; this.referenceCount = 1; }
public CustomChannelDispatcher(MyServiceManager serviceManager, IChannelListener<IReplyChannel> listener) { this.serviceManager = serviceManager; this.listener = listener; this.onReceive = new AsyncCallback(this.OnReceive); this.acceptCallback = new WaitCallback(this.AcceptCallback); }
public SecurityListenerSettingsLifetimeManager(SecurityProtocolFactory securityProtocolFactory, SecuritySessionServerSettings sessionSettings, bool sessionMode, IChannelListener innerListener) { this.securityProtocolFactory = securityProtocolFactory; this.sessionSettings = sessionSettings; this.sessionMode = sessionMode; this.innerListener = innerListener; // have a reference right from the start so that the state can be aborted before open referenceCount = 1; }
public void Load(string category, string hash, IChannelListener listener) { /* Load data in a separate thread, because we're an asynchronous load method. */ new Thread(delegate() { Channel channel = new Channel("Cached-Substream-Channel", ChannelType.TYPE_SUBSTREAM, null); listener.ChannelHeader(channel, null); listener.ChannelData(channel, Load(category, hash)); listener.ChannelEnd(channel); }).Start(); }
public Channel(string name, ChannelType type, IChannelListener listener) { this._id = Channel._nextId++; this._name = name + "-" + this.Id; this._state = ChannelState.STATE_HEADER; this._type = type; this._headerLength = 0; this._dataLength = 0; this._listener = listener; /* Force data state for AES key channel. */ if (this._type == ChannelType.TYPE_AESKEY) this._state = ChannelState.STATE_DATA; }
protected void WaitForChannel(IChannelListener listener, bool async, TimeSpan timeout) { bool ret = false; if (async) { IAsyncResult result = listener.BeginWaitForChannel(timeout, null, null); ret = listener.EndWaitForChannel(result); } else { ret = listener.WaitForChannel(timeout); } this.Results.Add(String.Format("WaitForChannel returned {0}", ret)); }
public async Task StartAsync() { if (listener != null) { throw new InvalidOperationException(ExceptionMessageListenerHasAlreadyBeenStarted); } try { var tcpRelayTransportBindingElement = new TcpRelayTransportBindingElement(RelayClientAuthenticationType.RelayAccessToken) { TransferMode = TransferMode.Buffered, ConnectionMode = TcpRelayConnectionMode.Relayed, IsDynamic = (relayAddressType == RelayAddressType.Dynamic), ManualAddressing = true }; tcpRelayTransportBindingElement.GetType() .GetProperty("TransportProtectionEnabled", BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.NonPublic) .SetValue(tcpRelayTransportBindingElement, true); var tb = new TransportClientEndpointBehavior(tokenProvider); this.listenerBinding = new CustomBinding( new BinaryMessageEncodingBindingElement(), tcpRelayTransportBindingElement); listener = listenerBinding.BuildChannelListener<IDuplexSessionChannel>(new Uri(address), tb); await Task.Factory.FromAsync(listener.BeginOpen, listener.EndOpen, null); } catch { listener = null; throw; } }
private static System.Type MaybeCreateListener(bool actuallyCreate, System.Type[] supportedChannels, Binding binding, BindingParameterCollection parameters, Uri listenUriBaseAddress, string listenUriRelativeAddress, ListenUriMode listenUriMode, ServiceThrottle throttle, out IChannelListener result, bool supportContextSession) { result = null; for (int i = 0; i < supportedChannels.Length; i++) { System.Type type = supportedChannels[i]; if ((type == typeof(IInputChannel)) && binding.CanBuildChannelListener<IInputChannel>(parameters)) { if (actuallyCreate) { result = binding.BuildChannelListener<IInputChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); } return typeof(IInputChannel); } if ((type == typeof(IReplyChannel)) && binding.CanBuildChannelListener<IReplyChannel>(parameters)) { if (actuallyCreate) { result = binding.BuildChannelListener<IReplyChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); } return typeof(IReplyChannel); } if ((type == typeof(IDuplexChannel)) && binding.CanBuildChannelListener<IDuplexChannel>(parameters)) { if (actuallyCreate) { result = binding.BuildChannelListener<IDuplexChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); } return typeof(IDuplexChannel); } if ((type == typeof(IInputSessionChannel)) && binding.CanBuildChannelListener<IInputSessionChannel>(parameters)) { if (actuallyCreate) { result = binding.BuildChannelListener<IInputSessionChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); } return typeof(IInputSessionChannel); } if ((type == typeof(IReplySessionChannel)) && binding.CanBuildChannelListener<IReplySessionChannel>(parameters)) { if (actuallyCreate) { result = binding.BuildChannelListener<IReplySessionChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); } return typeof(IReplySessionChannel); } if ((type == typeof(IDuplexSessionChannel)) && binding.CanBuildChannelListener<IDuplexSessionChannel>(parameters)) { if (actuallyCreate) { result = binding.BuildChannelListener<IDuplexSessionChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); } return typeof(IDuplexSessionChannel); } } for (int j = 0; j < supportedChannels.Length; j++) { System.Type type2 = supportedChannels[j]; if ((type2 == typeof(IInputChannel)) && binding.CanBuildChannelListener<IInputSessionChannel>(parameters)) { if (actuallyCreate) { IChannelListener<IInputSessionChannel> inner = binding.BuildChannelListener<IInputSessionChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); result = DatagramAdapter.GetInputListener(inner, throttle, binding); } return typeof(IInputSessionChannel); } if ((type2 == typeof(IReplyChannel)) && binding.CanBuildChannelListener<IReplySessionChannel>(parameters)) { if (actuallyCreate) { IChannelListener<IReplySessionChannel> listener2 = binding.BuildChannelListener<IReplySessionChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); result = DatagramAdapter.GetReplyListener(listener2, throttle, binding); } return typeof(IReplySessionChannel); } if ((supportContextSession && (type2 == typeof(IReplySessionChannel))) && (binding.CanBuildChannelListener<IReplyChannel>(parameters) && (binding.GetProperty<IContextSessionProvider>(parameters) != null))) { if (actuallyCreate) { result = binding.BuildChannelListener<IReplyChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); } return typeof(IReplyChannel); } } return null; }
void ChannelAccepted(IAsyncResult result) { try { IReplyChannel replyChannel = replyChannelListener.EndAcceptChannel(result); if (replyChannel != null) { try { replyChannel.Open(); replyChannel.BeginReceiveRequest(RequestAccepted, replyChannel); } catch { replyChannel.Abort(); } if (replyChannelListener.State == CommunicationState.Opened) { this.replyChannelListener.BeginAcceptChannel(ChannelAccepted, replyChannelListener); } } } catch (Exception e) { Console.WriteLine(e); this.replyChannelListener.Abort(); this.replyChannelListener = null; } }
public static SvcHttpHandler GetHandlerForListener (IChannelListener listener) { return handlers.Values.First (h => h.Host.ChannelDispatchers.Any (cd => cd.Listener == listener)); }
internal DuplexListenerBinder(IChannelListener <IDuplexChannel> listener, System.ServiceModel.Channels.MessageVersion messageVersion) { this.listener = listener; this.messageVersion = messageVersion; }
Type BuildChannelListener(StuffPerListenUriInfo stuff, ServiceHostBase serviceHost, Uri listenUri, ListenUriMode listenUriMode, out IChannelListener result) { Binding originalBinding = stuff.Endpoints[0].Binding; CustomBinding binding = new CustomBinding(originalBinding); BindingParameterCollection parameters = stuff.Parameters; Uri listenUriBaseAddress; string listenUriRelativeAddress; GetBaseAndRelativeAddresses(serviceHost, listenUri, binding.Scheme, out listenUriBaseAddress, out listenUriRelativeAddress); // I don't believe InternalDuplexBindingElement is needed, at least not initially. // It looks like it's used when a channel factory is used to supply the outgoing channel // for duplex. I think it binds an incoming listener to an outgoing channel to acheive duplex. //InternalDuplexBindingElement internalDuplex = null; //InternalDuplexBindingElement.AddDuplexListenerSupport(binding, ref internalDuplex); // All types are supported to start bool reply = true; bool replySession = true; bool input = true; bool inputSession = true; bool duplex = true; bool duplexSession = true; string sessionContractName = null; string datagramContractName = null; // each endpoint adds constraints for (int i = 0; i < stuff.Endpoints.Count; ++i) { ContractDescription contract = stuff.Endpoints[i].Contract; if (contract.SessionMode == SessionMode.Required) { sessionContractName = contract.Name; } if (contract.SessionMode == SessionMode.NotAllowed) { datagramContractName = contract.Name; } System.Collections.IList endpointTypes = GetSupportedChannelTypes(contract); if (!endpointTypes.Contains(typeof(IReplyChannel))) { reply = false; } if (!endpointTypes.Contains(typeof(IReplySessionChannel))) { replySession = false; } if (!endpointTypes.Contains(typeof(IInputChannel))) { input = false; } if (!endpointTypes.Contains(typeof(IInputSessionChannel))) { inputSession = false; } if (!endpointTypes.Contains(typeof(IDuplexChannel))) { duplex = false; } if (!endpointTypes.Contains(typeof(IDuplexSessionChannel))) { duplexSession = false; } } if ((sessionContractName != null) && (datagramContractName != null)) { string text = SR.Format(SR.SFxCannotRequireBothSessionAndDatagram3, datagramContractName, sessionContractName, binding.Name); Exception error = new InvalidOperationException(text); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(error); } List <Type> supportedChannelTypes = new List <Type>(); if (input) { supportedChannelTypes.Add(typeof(IInputChannel)); } if (inputSession) { supportedChannelTypes.Add(typeof(IInputSessionChannel)); } if (reply) { supportedChannelTypes.Add(typeof(IReplyChannel)); } if (replySession) { supportedChannelTypes.Add(typeof(IReplySessionChannel)); } if (duplex) { supportedChannelTypes.Add(typeof(IDuplexChannel)); } if (duplexSession) { supportedChannelTypes.Add(typeof(IDuplexSessionChannel)); } // now we know what channel types we can use to support the contracts at this ListenUri Type returnValue = MaybeCreateListener(true, supportedChannelTypes.ToArray(), binding, parameters, listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, out result); if (result == null) { // we put a lot of work into creating a good error message, as this is a common case Dictionary <Type, byte> setOfChannelTypesSupportedByBinding = new Dictionary <Type, byte>(); if (binding.CanBuildChannelListener <IInputChannel>()) { setOfChannelTypesSupportedByBinding.Add(typeof(IInputChannel), 0); } if (binding.CanBuildChannelListener <IReplyChannel>()) { setOfChannelTypesSupportedByBinding.Add(typeof(IReplyChannel), 0); } if (binding.CanBuildChannelListener <IDuplexChannel>()) { setOfChannelTypesSupportedByBinding.Add(typeof(IDuplexChannel), 0); } if (binding.CanBuildChannelListener <IInputSessionChannel>()) { setOfChannelTypesSupportedByBinding.Add(typeof(IInputSessionChannel), 0); } if (binding.CanBuildChannelListener <IReplySessionChannel>()) { setOfChannelTypesSupportedByBinding.Add(typeof(IReplySessionChannel), 0); } if (binding.CanBuildChannelListener <IDuplexSessionChannel>()) { setOfChannelTypesSupportedByBinding.Add(typeof(IDuplexSessionChannel), 0); } throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(ChannelRequirements.CantCreateListenerException( setOfChannelTypesSupportedByBinding.Keys, supportedChannelTypes, originalBinding.Name)); } return(returnValue); }
protected LayeredChannelListener(IDefaultCommunicationTimeouts timeouts, IChannelListener innerChannelListener) : this(false, timeouts, innerChannelListener) { }
public ClientCompositeDuplexChannel(ChannelManagerBase channelManager, IInputChannel innerInputChannel, IChannelListener <IInputChannel> innerInputListener, EndpointAddress localAddress, IOutputChannel innerOutputChannel, bool usesUniqueHeader) : base(channelManager, innerInputChannel, localAddress, innerOutputChannel) { this.innerInputListener = innerInputListener; this.usesUniqueHeader = usesUniqueHeader; }
internal void RecvReliablePackets(ServerDataProcessing process, List <Packet> packets, IChannelListener listener) { if (m_Dispose) { return; } if (process.RecvReliablePackets(this, packets, listener, m_Heartbeat)) { HandlePackets(packets); } }
/// <summary> /// Creates a new <see cref="IDeviceListener"/> instance. /// </summary> /// <param name="channelListener">The channel listener that will be used to listen for events.</param> /// <returns>A new <see cref="IDeviceListener"/> instance.</returns> /// <exception cref="System.ArgumentNullException">Thrown when the channel listener is null.</exception> public static IDeviceListener Create(IChannelListener channelListener) { return(new DeviceListener(channelListener)); }
public MyChannelDispatcher(IChannelListener l) : base(l) { }
public bool RecvReliablePackets(ServerChannel channel, List <Packet> packets, IChannelListener listener, ServerHeartbeatProcessing heartbeat) { while (true) { int size = channel.Recv(m_RecvBuffer, 0, m_RecvBuffer.Length); if (size <= 0) { break; } if (size == 8) { ByteReadMemory memory = new ByteReadMemory(m_RecvBuffer, 0, size); uint flag = memory.ReadUInt(); uint conv = memory.ReadUInt(); if (conv == channel.Conv) { if (flag == KcpConstants.Flag_Connect) { channel.SetConnectedStatus(true); if (listener != null) { listener.OnAddChannel(channel); } continue; } if (flag == KcpConstants.Flag_Disconnect) { channel.SetConnectedStatus(false); if (listener != null) { listener.OnRemoveChannel(channel); } continue; } if (flag == KcpConstants.Flag_Heartbeat) { heartbeat.UpdateHeartbeat(channel, m_RecvBuffer, 0, size); continue; } } } PacketProcessing.Recv(m_RecvBuffer, 0, size, packets); } return(packets.Count > 0); }
internal ReplyListenerBinder(IChannelListener <IReplyChannel> listener, MessageVersion messageVersion) { _listener = listener; _messageVersion = messageVersion; }
internal InputSessionListenerBinder(IChannelListener <IInputSessionChannel> listener, MessageVersion messageVersion) { _listener = listener; _messageVersion = messageVersion; }
internal DuplexSessionListenerBinder(IChannelListener <IDuplexSessionChannel> listener, MessageVersion messageVersion) { _correlator = new RequestReplyCorrelator(); _listener = listener; _messageVersion = messageVersion; }
public TransactionChannelListener(IChannelListener <TChannel> innerListener, TransactionProtocol protocol) { this.inner_listener = innerListener; this.protocol = protocol; }
public ChannelDispatcher( IChannelListener listener, string bindingName) : this(listener, bindingName, null) { }
/// <summary> /// Request replacements for a list of tracks. The response comes as compressed XML. /// </summary> public void SendReplacementRequest(IChannelListener listener, List <Track> tracks) { /* Calculate data length. */ int dataLength = 0; foreach (Track track in tracks) { if (track.Artist != null && track.Artist.Name != null) { dataLength += Encoding.UTF8.GetBytes(track.Artist.Name).Length; } if (track.Album != null && track.Album.Name != null) { dataLength += Encoding.UTF8.GetBytes(track.Album.Name).Length; } if (track.Title != null) { dataLength += Encoding.UTF8.GetBytes(track.Title).Length; } if (track.Length != -1) { dataLength += Encoding.UTF8.GetBytes((track.Length / 1000).ToString()).Length; } dataLength += 4; /* Separators */ } /* Create channel and buffer. */ Channel.Channel channel = new Channel.Channel("Browse-Channel", Channel.ChannelType.TYPE_BROWSE, listener); ByteBuffer buffer = ByteBuffer.Allocate(2 + 2 + 1 + dataLength); /* Append channel id and type. */ buffer.PutShort((short)channel.Id); buffer.PutShort((short)0x0000); /* Unknown. */ buffer.Put((byte)0x06); /* Append track info. */ foreach (Track track in tracks) { if (track.Artist != null && track.Artist.Name != null) { buffer.Put(Encoding.UTF8.GetBytes(track.Artist.Name)); } buffer.Put((byte)0x01); /* Separator. */ if (track.Album != null && track.Album.Name != null) { buffer.Put(Encoding.UTF8.GetBytes(track.Album.Name)); } buffer.Put((byte)0x01); /* Separator. */ if (track.Title != null) { buffer.Put(Encoding.UTF8.GetBytes(track.Title)); } buffer.Put((byte)0x01); /* Separator. */ if (track.Length != -1) { buffer.Put(Encoding.UTF8.GetBytes((track.Length / 1000).ToString())); } buffer.Put((byte)0x00); /* Separator. */ } buffer.Flip(); /* Register channel. */ Channel.Channel.Register(channel); /* Send packet. */ this.SendPacket(Command.COMMAND_BROWSE, buffer); }
public HttpMessageEncodingChannelListener(Binding binding, IChannelListener <IReplyChannel> innerListener) : base(binding, innerListener) { }
/// <summary> /// Search music. The response comes as GZIP compressed XML. /// </summary> public void SendSearchQuery(IChannelListener listener, string query) { this.SendSearchQuery(listener, query, 0, -1); }
internal ReplySessionListenerBinder(IChannelListener<IReplySessionChannel> listener, System.ServiceModel.Channels.MessageVersion messageVersion) { this.listener = listener; this.messageVersion = messageVersion; }
void AddMetadataEndpoint(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher, bool debugMode) { Uri baseAddress = endpoint.Address.Uri; if (baseAddress == null) { return; } ServiceHostBase host = endpointDispatcher.ChannelDispatcher.Host; UriBuilder builder = new UriBuilder(baseAddress); builder.Path += builder.Path.EndsWith("/", StringComparison.OrdinalIgnoreCase) ? (WebScriptClientGenerator.GetMetadataEndpointSuffix(debugMode)) : ("/" + WebScriptClientGenerator.GetMetadataEndpointSuffix(debugMode)); EndpointAddress metadataAddress = new EndpointAddress(builder.Uri); foreach (ServiceEndpoint serviceEndpoint in host.Description.Endpoints) { if (EndpointAddress.UriEquals(serviceEndpoint.Address.Uri, metadataAddress.Uri, true, false))// ignoreCase // includeHostNameInComparison { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError( new InvalidOperationException(SR2.GetString(SR2.JsonNoEndpointAtMetadataAddress, this.GetType().ToString(), serviceEndpoint.Address, serviceEndpoint.Name, host.Description.Name))); } } HttpTransportBindingElement transportBindingElement; HttpTransportBindingElement existingTransportBindingElement = endpoint.Binding.CreateBindingElements().Find <HttpTransportBindingElement>(); if (existingTransportBindingElement != null) { transportBindingElement = (HttpTransportBindingElement)existingTransportBindingElement.Clone(); } else { if (baseAddress.Scheme == "https") { transportBindingElement = new HttpsTransportBindingElement(); } else { transportBindingElement = new HttpTransportBindingElement(); } } transportBindingElement.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard; transportBindingElement.TransferMode = TransferMode.Buffered; transportBindingElement.MaxBufferSize = MaxMetadataEndpointBufferSize; transportBindingElement.MaxReceivedMessageSize = MaxMetadataEndpointBufferSize; Binding metadataBinding = new CustomBinding( new WebScriptMetadataMessageEncodingBindingElement(), transportBindingElement); BindingParameterCollection parameters = host.GetBindingParameters(endpoint); // build endpoint dispatcher ContractDescription metadataContract = ContractDescription.GetContract(typeof(ServiceMetadataExtension.IHttpGetMetadata)); OperationDescription metadataOperation = metadataContract.Operations[0]; EndpointDispatcher metadataEndpointDispatcher = new EndpointDispatcher(metadataAddress, metadataContract.Name, metadataContract.Namespace); DispatchOperation dispatchOperation = new DispatchOperation(metadataEndpointDispatcher.DispatchRuntime, metadataOperation.Name, metadataOperation.Messages[0].Action, metadataOperation.Messages[1].Action); dispatchOperation.Formatter = new WebScriptMetadataFormatter(); dispatchOperation.Invoker = new SyncMethodInvoker(metadataOperation.SyncMethod); metadataEndpointDispatcher.DispatchRuntime.Operations.Add(dispatchOperation); metadataEndpointDispatcher.DispatchRuntime.SingletonInstanceContext = new InstanceContext(host, new WebScriptClientGenerator(endpoint, debugMode, !String.IsNullOrEmpty(this.JavascriptCallbackParameterName))); metadataEndpointDispatcher.DispatchRuntime.InstanceContextProvider = new SingletonInstanceContextProvider(metadataEndpointDispatcher.DispatchRuntime); // build channel dispatcher IChannelListener <IReplyChannel> listener = null; if (metadataBinding.CanBuildChannelListener <IReplyChannel>(parameters)) { listener = metadataBinding.BuildChannelListener <IReplyChannel>(metadataAddress.Uri, parameters); } ChannelDispatcher metadataChannelDispatcher = new ChannelDispatcher(listener); metadataChannelDispatcher.MessageVersion = MessageVersion.None; metadataChannelDispatcher.Endpoints.Add(metadataEndpointDispatcher); host.ChannelDispatchers.Add(metadataChannelDispatcher); }
static Type MaybeCreateListener(bool actuallyCreate, Type[] supportedChannels, Binding binding, BindingParameterCollection parameters, Uri listenUriBaseAddress, string listenUriRelativeAddress, ListenUriMode listenUriMode, out IChannelListener result) { // if actuallyCreate is true, then this behaves like CreateListener() // else this behaves like CanCreateListener() // result is channel type that was (would be) created, null if can't create // // Ugly API helps refactor common code in these two similar-but-different methods result = null; for (int i = 0; i < supportedChannels.Length; i++) { Type channelType = supportedChannels[i]; if (channelType == typeof(IInputChannel)) { if (binding.CanBuildChannelListener <IInputChannel>(parameters)) { if (actuallyCreate) { result = binding.BuildChannelListener <IInputChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); } return(typeof(IInputChannel)); } } if (channelType == typeof(IReplyChannel)) { if (binding.CanBuildChannelListener <IReplyChannel>(parameters)) { if (actuallyCreate) { result = binding.BuildChannelListener <IReplyChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); } return(typeof(IReplyChannel)); } } if (channelType == typeof(IDuplexChannel)) { if (binding.CanBuildChannelListener <IDuplexChannel>(parameters)) { if (actuallyCreate) { result = binding.BuildChannelListener <IDuplexChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); } return(typeof(IDuplexChannel)); } } if (channelType == typeof(IInputSessionChannel)) { if (binding.CanBuildChannelListener <IInputSessionChannel>(parameters)) { if (actuallyCreate) { result = binding.BuildChannelListener <IInputSessionChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); } return(typeof(IInputSessionChannel)); } } if (channelType == typeof(IReplySessionChannel)) { if (binding.CanBuildChannelListener <IReplySessionChannel>(parameters)) { if (actuallyCreate) { result = binding.BuildChannelListener <IReplySessionChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); } return(typeof(IReplySessionChannel)); } } if (channelType == typeof(IDuplexSessionChannel)) { if (binding.CanBuildChannelListener <IDuplexSessionChannel>(parameters)) { if (actuallyCreate) { result = binding.BuildChannelListener <IDuplexSessionChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); } return(typeof(IDuplexSessionChannel)); } } } return(null); }
protected override void OnOpening() { _innerChannelListener = (IChannelListener <IReplyChannel>)InnerChannelListener; base.OnOpening(); }
internal ReplySessionListenerBinder(IChannelListener <IReplySessionChannel> listener, System.ServiceModel.Channels.MessageVersion messageVersion) { this.listener = listener; this.messageVersion = messageVersion; }
internal ReplySessionListenerBinder(IChannelListener<IReplySessionChannel> listener, MessageVersion messageVersion) { this.listener = listener; this.messageVersion = messageVersion; }
public void Open() { this.replyChannelListener = this.upstreamBinding.BuildChannelListener<IReplyChannel>(this.upstreamUri, credentials); this.replyChannelListener.Open(); this.replyChannelListener.BeginAcceptChannel(ChannelAccepted, replyChannelListener); }
public uint Subscribe(IChannelListener listener) { //when a message comes in over udp, we want to fire the listener.MessageArrived function uint token = this.tokenCount++; Console.WriteLine("Subscribe req for udp channel. Token: " + token.ToString()); if (this.sock == null) BuildSocket(); lock (this.listeners) { this.listeners.Add(token, listener); } return token; }
private System.Type BuildChannelListener(StuffPerListenUriInfo stuff, ServiceHostBase serviceHost, Uri listenUri, ListenUriMode listenUriMode, bool supportContextSession, out IChannelListener result) { Uri uri; string str; Binding binding = stuff.Endpoints[0].Binding; CustomBinding binding2 = new CustomBinding(binding); BindingParameterCollection parameters = stuff.Parameters; this.GetBaseAndRelativeAddresses(serviceHost, listenUri, binding2.Scheme, out uri, out str); InternalDuplexBindingElement internalDuplexBindingElement = null; InternalDuplexBindingElement.AddDuplexListenerSupport(binding2, ref internalDuplexBindingElement); bool flag = true; bool flag2 = true; bool flag3 = true; bool flag4 = true; bool flag5 = true; bool flag6 = true; string name = null; string str3 = null; for (int i = 0; i < stuff.Endpoints.Count; i++) { ContractDescription contract = stuff.Endpoints[i].Contract; if (contract.SessionMode == SessionMode.Required) { name = contract.Name; } if (contract.SessionMode == SessionMode.NotAllowed) { str3 = contract.Name; } IList supportedChannelTypes = GetSupportedChannelTypes(contract); if (!supportedChannelTypes.Contains(typeof(IReplyChannel))) { flag = false; } if (!supportedChannelTypes.Contains(typeof(IReplySessionChannel))) { flag2 = false; } if (!supportedChannelTypes.Contains(typeof(IInputChannel))) { flag3 = false; } if (!supportedChannelTypes.Contains(typeof(IInputSessionChannel))) { flag4 = false; } if (!supportedChannelTypes.Contains(typeof(IDuplexChannel))) { flag5 = false; } if (!supportedChannelTypes.Contains(typeof(IDuplexSessionChannel))) { flag6 = false; } } if ((name != null) && (str3 != null)) { Exception exception = new InvalidOperationException(System.ServiceModel.SR.GetString("SFxCannotRequireBothSessionAndDatagram3", new object[] { str3, name, binding2.Name })); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(exception); } List<System.Type> requiredChannels = new List<System.Type>(); if (flag3) { requiredChannels.Add(typeof(IInputChannel)); } if (flag4) { requiredChannels.Add(typeof(IInputSessionChannel)); } if (flag) { requiredChannels.Add(typeof(IReplyChannel)); } if (flag2) { requiredChannels.Add(typeof(IReplySessionChannel)); } if (flag5) { requiredChannels.Add(typeof(IDuplexChannel)); } if (flag6) { requiredChannels.Add(typeof(IDuplexSessionChannel)); } System.Type type = MaybeCreateListener(true, requiredChannels.ToArray(), binding2, parameters, uri, str, listenUriMode, serviceHost.ServiceThrottle, out result, supportContextSession && (name != null)); if (result != null) { return type; } Dictionary<System.Type, byte> dictionary = new Dictionary<System.Type, byte>(); if (binding2.CanBuildChannelListener<IInputChannel>(new object[0])) { dictionary.Add(typeof(IInputChannel), 0); } if (binding2.CanBuildChannelListener<IReplyChannel>(new object[0])) { dictionary.Add(typeof(IReplyChannel), 0); } if (binding2.CanBuildChannelListener<IDuplexChannel>(new object[0])) { dictionary.Add(typeof(IDuplexChannel), 0); } if (binding2.CanBuildChannelListener<IInputSessionChannel>(new object[0])) { dictionary.Add(typeof(IInputSessionChannel), 0); } if (binding2.CanBuildChannelListener<IReplySessionChannel>(new object[0])) { dictionary.Add(typeof(IReplySessionChannel), 0); } if (binding2.CanBuildChannelListener<IDuplexSessionChannel>(new object[0])) { dictionary.Add(typeof(IDuplexSessionChannel), 0); } throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(ChannelRequirements.CantCreateListenerException(dictionary.Keys, requiredChannels, binding.Name)); }
Type BuildChannelListener(StuffPerListenUriInfo stuff, ServiceHostBase serviceHost, Uri listenUri, ListenUriMode listenUriMode, bool supportContextSession, out IChannelListener result) { Binding originalBinding = stuff.Endpoints[0].Binding; CustomBinding binding = new CustomBinding(originalBinding); BindingParameterCollection parameters = stuff.Parameters; Uri listenUriBaseAddress; string listenUriRelativeAddress; GetBaseAndRelativeAddresses(serviceHost, listenUri, binding.Scheme, out listenUriBaseAddress, out listenUriRelativeAddress); InternalDuplexBindingElement internalDuplex = null; InternalDuplexBindingElement.AddDuplexListenerSupport(binding, ref internalDuplex); // All types are supported to start bool reply = true; bool replySession = true; bool input = true; bool inputSession = true; bool duplex = true; bool duplexSession = true; string sessionContractName = null; string datagramContractName = null; // each endpoint adds constraints for (int i = 0; i < stuff.Endpoints.Count; ++i) { ContractDescription contract = stuff.Endpoints[i].Contract; if (contract.SessionMode == SessionMode.Required) { sessionContractName = contract.Name; } if (contract.SessionMode == SessionMode.NotAllowed) { datagramContractName = contract.Name; } System.Collections.IList endpointTypes = GetSupportedChannelTypes(contract); if (!endpointTypes.Contains(typeof(IReplyChannel))) { reply = false; } if (!endpointTypes.Contains(typeof(IReplySessionChannel))) { replySession = false; } if (!endpointTypes.Contains(typeof(IInputChannel))) { input = false; } if (!endpointTypes.Contains(typeof(IInputSessionChannel))) { inputSession = false; } if (!endpointTypes.Contains(typeof(IDuplexChannel))) { duplex = false; } if (!endpointTypes.Contains(typeof(IDuplexSessionChannel))) { duplexSession = false; } } if ((sessionContractName != null) && (datagramContractName != null)) { string text = SR.GetString(SR.SFxCannotRequireBothSessionAndDatagram3, datagramContractName, sessionContractName, binding.Name); Exception error = new InvalidOperationException(text); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(error); } List<Type> supportedChannelTypes = new List<Type>(); if (input) { supportedChannelTypes.Add(typeof(IInputChannel)); } if (inputSession) { supportedChannelTypes.Add(typeof(IInputSessionChannel)); } if (reply) { supportedChannelTypes.Add(typeof(IReplyChannel)); } if (replySession) { supportedChannelTypes.Add(typeof(IReplySessionChannel)); } if (duplex) { supportedChannelTypes.Add(typeof(IDuplexChannel)); } if (duplexSession) { supportedChannelTypes.Add(typeof(IDuplexSessionChannel)); } // now we know what channel types we can use to support the contracts at this ListenUri Type returnValue = DispatcherBuilder.MaybeCreateListener(true, supportedChannelTypes.ToArray(), binding, parameters, listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, serviceHost.ServiceThrottle, out result, supportContextSession && sessionContractName != null); if (result == null) { // we put a lot of work into creating a good error message, as this is a common case Dictionary<Type, byte> setOfChannelTypesSupportedByBinding = new Dictionary<Type, byte>(); if (binding.CanBuildChannelListener<IInputChannel>()) { setOfChannelTypesSupportedByBinding.Add(typeof(IInputChannel), 0); } if (binding.CanBuildChannelListener<IReplyChannel>()) { setOfChannelTypesSupportedByBinding.Add(typeof(IReplyChannel), 0); } if (binding.CanBuildChannelListener<IDuplexChannel>()) { setOfChannelTypesSupportedByBinding.Add(typeof(IDuplexChannel), 0); } if (binding.CanBuildChannelListener<IInputSessionChannel>()) { setOfChannelTypesSupportedByBinding.Add(typeof(IInputSessionChannel), 0); } if (binding.CanBuildChannelListener<IReplySessionChannel>()) { setOfChannelTypesSupportedByBinding.Add(typeof(IReplySessionChannel), 0); } if (binding.CanBuildChannelListener<IDuplexSessionChannel>()) { setOfChannelTypesSupportedByBinding.Add(typeof(IDuplexSessionChannel), 0); } throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(ChannelRequirements.CantCreateListenerException( setOfChannelTypesSupportedByBinding.Keys, supportedChannelTypes, originalBinding.Name)); } return returnValue; }
/// <summary>Add a connection listener.</summary> /// <param name="channelListener">The listener.</param> public virtual void AddChannelListener(IChannelListener channelListener) { this.channelListener.AddDelegate(channelListener); }
static Type MaybeCreateListener(bool actuallyCreate, Type[] supportedChannels, Binding binding, BindingParameterCollection parameters, Uri listenUriBaseAddress, string listenUriRelativeAddress, ListenUriMode listenUriMode, ServiceThrottle throttle, out IChannelListener result, bool supportContextSession) { // if actuallyCreate is true, then this behaves like CreateListener() // else this behaves like CanCreateListener() // result is channel type that was (would be) created, null if can't create // // Ugly API helps refactor common code in these two similar-but-different methods result = null; for (int i = 0; i < supportedChannels.Length; i++) { Type channelType = supportedChannels[i]; if (channelType == typeof(IInputChannel)) { if (binding.CanBuildChannelListener<IInputChannel>(parameters)) { if (actuallyCreate) { result = binding.BuildChannelListener<IInputChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); } return typeof(IInputChannel); } } if (channelType == typeof(IReplyChannel)) { if (binding.CanBuildChannelListener<IReplyChannel>(parameters)) { if (actuallyCreate) { result = binding.BuildChannelListener<IReplyChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); } return typeof(IReplyChannel); } } if (channelType == typeof(IDuplexChannel)) { if (binding.CanBuildChannelListener<IDuplexChannel>(parameters)) { if (actuallyCreate) { result = binding.BuildChannelListener<IDuplexChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); } return typeof(IDuplexChannel); } } if (channelType == typeof(IInputSessionChannel)) { if (binding.CanBuildChannelListener<IInputSessionChannel>(parameters)) { if (actuallyCreate) { result = binding.BuildChannelListener<IInputSessionChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); } return typeof(IInputSessionChannel); } } if (channelType == typeof(IReplySessionChannel)) { if (binding.CanBuildChannelListener<IReplySessionChannel>(parameters)) { if (actuallyCreate) { result = binding.BuildChannelListener<IReplySessionChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); } return typeof(IReplySessionChannel); } } if (channelType == typeof(IDuplexSessionChannel)) { if (binding.CanBuildChannelListener<IDuplexSessionChannel>(parameters)) { if (actuallyCreate) { result = binding.BuildChannelListener<IDuplexSessionChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); } return typeof(IDuplexSessionChannel); } } } // If the binding does not support the type natively, try to adapt for (int i = 0; i < supportedChannels.Length; i++) { Type channelType = supportedChannels[i]; // For SessionMode.Allowed or SessionMode.NotAllowed we will accept session-ful variants as well and adapt them if (channelType == typeof(IInputChannel)) { if (binding.CanBuildChannelListener<IInputSessionChannel>(parameters)) { if (actuallyCreate) { IChannelListener<IInputSessionChannel> temp = binding.BuildChannelListener<IInputSessionChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); result = DatagramAdapter.GetInputListener(temp, throttle, binding); } return typeof(IInputSessionChannel); } } if (channelType == typeof(IReplyChannel)) { if (binding.CanBuildChannelListener<IReplySessionChannel>(parameters)) { if (actuallyCreate) { IChannelListener<IReplySessionChannel> temp = binding.BuildChannelListener<IReplySessionChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); result = DatagramAdapter.GetReplyListener(temp, throttle, binding); } return typeof(IReplySessionChannel); } } if (supportContextSession) { // and for SessionMode.Required, it is possible that the InstanceContextProvider is handling the session management, so // accept datagram variants if that is the case if (channelType == typeof(IReplySessionChannel)) { if (binding.CanBuildChannelListener<IReplyChannel>(parameters) && binding.GetProperty<IContextSessionProvider>(parameters) != null) { if (actuallyCreate) { result = binding.BuildChannelListener<IReplyChannel>(listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, parameters); } return typeof(IReplyChannel); } } } } return null; }
//private readonly BufferManager _bufferManager; ////private readonly MessageEncoderFactory _encoderFactory; //private readonly Uri _uri; public MetaReplyChannelListener(TransportBindingElement transportElement, BindingContext context, IChannelListener <IReplyChannel> innerListener) : base(context.Binding) { _innerListener = innerListener; //this.MaxReceivedMessageSize = transportElement.MaxReceivedMessageSize; //var messageElement = context.BindingParameters.Remove<MessageEncodingBindingElement>(); //this._bufferManager = BufferManager.CreateBufferManager(transportElement.MaxBufferPoolSize, (int)this.MaxReceivedMessageSize); ////this._encoderFactory = messageElement.CreateMessageEncoderFactory(); //this._uri = new Uri(context.ListenUriBaseAddress, context.ListenUriRelativeAddress); }
public ChannelDispatcher(IChannelListener listener) : this(listener, null) { }
internal DuplexListenerBinder(IChannelListener<IDuplexChannel> listener, System.ServiceModel.Channels.MessageVersion messageVersion) { this.listener = listener; this.messageVersion = messageVersion; }
public RelayHttpTransportChannelListener(BindingContext context, MessageEncodingBindingElement encodingBindingElement, IChannelListener <IReplyChannel> innerChannelListener) : base(context.Binding, innerChannelListener) { this.innerChannelListener = innerChannelListener; this.listenUri = this.innerChannelListener.Uri; this.encoder = encodingBindingElement.CreateMessageEncoderFactory().Encoder; this.preserveRawHttp = context.BindingParameters.Find <NameSettings>().ServiceSettings.PreserveRawHttp; }
private void AcceptChannelAndReceive(IChannelListener<IInputChannel> listener) { IInputChannel channel; TransactionScope transactionToAbortOnAccept = null; if (this.Parameters.AbortTxDatagramAccept) { transactionToAbortOnAccept = new TransactionScope(TransactionScopeOption.RequiresNew); } if (this.Parameters.AsyncAccept) { IAsyncResult result = listener.BeginAcceptChannel(null, null); channel = listener.EndAcceptChannel(result); } else { channel = listener.AcceptChannel(); } if (this.Parameters.AbortTxDatagramAccept) { transactionToAbortOnAccept.Dispose(); } channel.Open(); Message message; if (this.Parameters.CloseListenerEarly) { listener.Close(); } try { using (TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew)) { Message firstMessage = channel.Receive(this.Parameters.ReceiveTimeout); lock (this.Results) { this.Results.Add(String.Format("Received message with Action '{0}'", firstMessage.Headers.Action)); } ts.Complete(); } } catch (TimeoutException) { lock (this.Results) { this.Results.Add("Receive timed out."); } channel.Abort(); return; } AutoResetEvent doneReceiving = new AutoResetEvent(false); int threadsCompleted = 0; for (int i = 0; i < this.Parameters.NumberOfThreads; ++i) { ThreadPool.QueueUserWorkItem(new WaitCallback(delegate(object unused) { do { if (this.Parameters.ReceiverShouldAbort) { this.ReceiveMessage(channel, false); Thread.Sleep(200); } message = this.ReceiveMessage(channel, true); } while (message != null); if (Interlocked.Increment(ref threadsCompleted) == this.Parameters.NumberOfThreads) { doneReceiving.Set(); } })); } TimeSpan threadTimeout = TimeSpan.FromMinutes(2.0); if (!doneReceiving.WaitOne(threadTimeout, false)) { this.Results.Add(String.Format("Threads did not complete within {0}.", threadTimeout)); } channel.Close(); }
internal InputListenerBinder(IChannelListener <IInputChannel> listener, MessageVersion messageVersion) { this.listener = listener; this.messageVersion = messageVersion; }
internal InputListenerBinder(IChannelListener<IInputChannel> listener, MessageVersion messageVersion) { this.listener = listener; this.messageVersion = messageVersion; }
internal ReplySessionListenerBinder(IChannelListener <IReplySessionChannel> listener, MessageVersion messageVersion) { this.listener = listener; this.messageVersion = messageVersion; }
internal DuplexSessionListenerBinder(IChannelListener<IDuplexSessionChannel> listener, MessageVersion messageVersion) { this.correlator = new RequestReplyCorrelator(); this.listener = listener; this.messageVersion = messageVersion; }
internal DuplexListenerBinder(IChannelListener <IDuplexChannel> listener, MessageVersion messageVersion) { correlator = new RequestReplyCorrelator(); this.listener = listener; this.messageVersion = messageVersion; }
public ServiceHost(IChannelListener channelListener) : base(channelListener) { }
protected LayeredChannelListener(bool sharedInnerListener, IDefaultCommunicationTimeouts timeouts, IChannelListener innerChannelListener) : base(timeouts) { _sharedInnerListener = sharedInnerListener; _innerChannelListener = innerChannelListener; _onInnerListenerFaulted = new EventHandler(OnInnerListenerFaulted); if (_innerChannelListener != null) { _innerChannelListener.Faulted += _onInnerListenerFaulted; } }
static internal Type MaybeCreateListener(bool actuallyCreate, Type[] supportedChannels, Binding binding, BindingParameterCollection parameters, Uri listenUriBaseAddress, string listenUriRelativeAddress, ListenUriMode listenUriMode, ServiceThrottle throttle, out IChannelListener result) { return MaybeCreateListener(actuallyCreate, supportedChannels, binding, parameters, listenUriBaseAddress, listenUriRelativeAddress, listenUriMode, throttle, out result, false); }
/// <summary> /// Initializes a new instance of the <see cref="Hub"/> class. /// </summary> /// <param name="channelListener">The channel listener.</param> /// <exception cref="System.ArgumentNullException">Thrown when the channel listener is null.</exception> protected Hub(IChannelListener channelListener) : this(DeviceListener.Create(channelListener)) { // Contract.Requires<ArgumentNullException>(channelListener != null, "channelListener"); }
public void AcceptChannelWithoutOpenListener() { IChannelListener <IReplyChannel> listener = CreateListener(null, null); listener.AcceptChannel(); }
public Subscriber(IChannelListener session) { Session = session; Channels = new List <string>(); }