/// <summary> /// Opens the listener and starts accepting connection. /// </summary> /// <param name="baseAddress">The base address.</param> /// <param name="settings">The settings to use when creating the listener.</param> /// <param name="callback">The callback to use when requests arrive via the channel.</param> /// <exception cref="ArgumentNullException">Thrown if any parameter is null.</exception> /// <exception cref="ServiceResultException">Thrown if any communication error occurs.</exception> public void Open(Uri baseAddress, TransportListenerSettings settings, ITransportListenerCallback callback) { // assign a unique guid to the listener. m_listenerId = Guid.NewGuid().ToString(); m_uri = baseAddress; m_descriptions = settings.Descriptions; m_configuration = settings.Configuration; // initialize the quotas. m_quotas = new TcpChannelQuotas(); m_quotas.MaxBufferSize = m_configuration.MaxBufferSize; m_quotas.MaxMessageSize = m_configuration.MaxMessageSize; m_quotas.ChannelLifetime = m_configuration.ChannelLifetime; m_quotas.SecurityTokenLifetime = m_configuration.SecurityTokenLifetime; m_quotas.MessageContext = new ServiceMessageContext(); m_quotas.MessageContext.MaxArrayLength = m_configuration.MaxArrayLength; m_quotas.MessageContext.MaxByteStringLength = m_configuration.MaxByteStringLength; m_quotas.MessageContext.MaxMessageSize = m_configuration.MaxMessageSize; m_quotas.MessageContext.MaxStringLength = m_configuration.MaxStringLength; m_quotas.MessageContext.NamespaceUris = settings.NamespaceUris; m_quotas.MessageContext.ServerUris = new StringTable(); m_quotas.MessageContext.Factory = settings.Factory; m_quotas.CertificateValidator = settings.CertificateValidator; // save the callback to the server. m_callback = callback; // start the listener. Start(); }
/// <summary> /// Opens the listener and starts accepting connection. /// </summary> /// <param name="baseAddress">The base address.</param> /// <param name="settings">The settings to use when creating the listener.</param> /// <param name="callback">The callback to use when requests arrive via the channel.</param> /// <exception cref="ArgumentNullException">Thrown if any parameter is null.</exception> /// <exception cref="ServiceResultException">Thrown if any communication error occurs.</exception> public void Open( Uri baseAddress, TransportListenerSettings settings, ITransportListenerCallback callback) { // assign a unique guid to the listener. m_listenerId = Guid.NewGuid().ToString(); m_uri = baseAddress; m_descriptions = settings.Descriptions; EndpointConfiguration configuration = settings.Configuration; // initialize the quotas. m_quotas = new ChannelQuotas(); var messageContext = new ServiceMessageContext() { NamespaceUris = settings.NamespaceUris, ServerUris = new StringTable(), Factory = settings.Factory }; if (configuration != null) { m_quotas.MaxBufferSize = configuration.MaxBufferSize; m_quotas.MaxMessageSize = configuration.MaxMessageSize; m_quotas.ChannelLifetime = configuration.ChannelLifetime; m_quotas.SecurityTokenLifetime = configuration.SecurityTokenLifetime; messageContext.MaxArrayLength = configuration.MaxArrayLength; messageContext.MaxByteStringLength = configuration.MaxByteStringLength; messageContext.MaxMessageSize = configuration.MaxMessageSize; messageContext.MaxStringLength = configuration.MaxStringLength; } m_quotas.MessageContext = messageContext; m_quotas.CertificateValidator = settings.CertificateValidator; // save the server certificate. m_serverCertificate = settings.ServerCertificate; m_serverCertificateChain = settings.ServerCertificateChain; m_bufferManager = new BufferManager("Server", (int)Int32.MaxValue, m_quotas.MaxBufferSize); m_channels = new Dictionary <uint, TcpListenerChannel>(); m_reverseConnectListener = settings.ReverseConnectListener; // save the callback to the server. m_callback = callback; // start the listener. Start(); }
/// <summary> /// Opens the listener and starts accepting connection. /// </summary> /// <param name="baseAddress">The base address.</param> /// <param name="settings">The settings to use when creating the listener.</param> /// <param name="callback">The callback to use when requests arrive via the channel.</param> /// <exception cref="ArgumentNullException">Thrown if any parameter is null.</exception> /// <exception cref="ServiceResultException">Thrown if any communication error occurs.</exception> public void Open(Uri baseAddress, TransportListenerSettings settings, ITransportListenerCallback callback) { }