Пример #1
0
        /// <summary>
        /// Constructs an instance of the GenuineUdpChannel class.
        /// </summary>
        /// <param name="properties">An IDictionary of the channel properties which hold the configuration information for the current channel.</param>
        /// <param name="iClientChannelSinkProvider">The IClientChannelSinkProvider that creates the client channel sinks for the underlying channel through which remoting messages flow through.</param>
        /// <param name="iServerChannelSinkProvider">The IServerChannelSinkProvider that creates server channel sinks for the underlying channel through which remoting messages flow through.</param>
        public GenuineUdpChannel(IDictionary properties, IClientChannelSinkProvider iClientChannelSinkProvider, IServerChannelSinkProvider iServerChannelSinkProvider)
            : base(iClientChannelSinkProvider, iServerChannelSinkProvider)
        {
            this.ITransportContext = TransportContextServices.CreateDefaultUdpContext(properties, this);
            this.InitializeInstance(properties);

            if (this._channelName == null)
            {
                this._channelName = "gudp";
            }
            if (this._urlPrefix == null)
            {
                this._urlPrefix = "gudp";
            }
            this._possibleChannelPrefixes = new string[] { this.UrlPrefix, this.UriPrefix, GetBroadcastUriPrefix(this.UrlPrefix), GetBroadcastUriPrefix(this.UriPrefix) };

            // retrieve settings
            string uriToListen = this["Address"] as string;

            foreach (DictionaryEntry entry in properties)
            {
                if (string.Compare(entry.Key.ToString(), "Address", true) == 0)
                {
                    uriToListen = entry.Value.ToString();
                }
            }
            if (uriToListen == null || uriToListen.Length <= 0 || !uriToListen.StartsWith(this.UrlPrefix + ":"))
            {
                throw GenuineExceptions.Get_Server_IncorrectAddressToListen(uriToListen);
            }

            this.StartListening(uriToListen);
        }
Пример #2
0
        /// <summary>
        /// Constructs an instance of the GenuineHttpClientChannel class.
        /// </summary>
        /// <param name="properties">An IDictionary of the channel properties which hold the configuration information for the current channel.</param>
        /// <param name="iClientChannelSinkProvider">The IClientChannelSinkProvider that creates the client channel sinks for the underlying channel through which remoting messages flow through.</param>
        /// <param name="iServerChannelSinkProvider">The IServerChannelSinkProvider that creates server channel sinks for the underlying channel through which remoting messages flow through.</param>
        public GenuineHttpClientChannel(IDictionary properties, IClientChannelSinkProvider iClientChannelSinkProvider, IServerChannelSinkProvider iServerChannelSinkProvider) :
            base(iClientChannelSinkProvider, iServerChannelSinkProvider)
        {
            this.ITransportContext = TransportContextServices.CreateDefaultClientHttpContext(properties, this);
            this.InitializeInstance(properties);

            if (this._channelName == null)
            {
                this._channelName = "ghttp";
            }
            if (this._urlPrefix == null)
            {
                this._urlPrefix = "ghttp";
            }
            this._possibleChannelPrefixes = new string[] { this.UrlPrefix, this.UriPrefix };
        }
        /// <summary>
        /// Constructs an instance of the GenuineSharedMemoryChannel class.
        /// </summary>
        /// <param name="properties">An IDictionary of the channel properties which hold the configuration information for the current channel.</param>
        /// <param name="iClientChannelSinkProvider">The IClientChannelSinkProvider that creates the client channel sinks for the underlying channel through which remoting messages flow through.</param>
        /// <param name="iServerChannelSinkProvider">The IServerChannelSinkProvider that creates server channel sinks for the underlying channel through which remoting messages flow through.</param>
        public GenuineSharedMemoryChannel(IDictionary properties, IClientChannelSinkProvider iClientChannelSinkProvider, IServerChannelSinkProvider iServerChannelSinkProvider)
            : base(iClientChannelSinkProvider, iServerChannelSinkProvider)
        {
            this.ITransportContext = TransportContextServices.CreateDefaultSharedMemoryContext(properties, this);
            this.InitializeInstance(properties);

            if (this._channelName == null)
            {
                this._channelName = "gshmem";
            }
            if (this._urlPrefix == null)
            {
                this._urlPrefix = "gshmem";
            }
            this._possibleChannelPrefixes = new string[] { this.UrlPrefix, this.UriPrefix };

            // retrieve settings
            foreach (DictionaryEntry entry in properties)
            {
                if (string.Compare(entry.Key.ToString(), "listen", true) == 0)
                {
                    this._uriToListen = entry.Value.ToString();
                }
            }

            if (this._uriToListen != null && (this._uriToListen.Length <= 0 || !this._uriToListen.StartsWith("gshmem:")))
            {
                throw GenuineExceptions.Get_Server_IncorrectAddressToListen(this._uriToListen);
            }

            // start listening
            if (this._uriToListen != null)
            {
                this.StartListening(null);
            }
        }