상속: System.Runtime.Remoting.Channels.BaseChannelWithProperties, IChannelSender, IChannel, ISecurableChannel
예제 #1
0
		public void Run()
		{
			try
			{
				tcp =  new TcpChannel (0);
				
				Hashtable options = new Hashtable ();
				options ["timeout"] = 10000; // 10s
				http = new HttpClientChannel (options, null);
			
				ChannelServices.RegisterChannel (tcp);
				ChannelServices.RegisterChannel (http);
			
				AppDomain domain = BaseCallTest.CreateDomain ("testdomain_activation");
				server = (ActivationServer) domain.CreateInstanceAndUnwrap(GetType().Assembly.FullName,"MonoTests.Remoting.ActivationServer");
				
				RemotingConfiguration.RegisterActivatedClientType (typeof(CaObject1), "tcp://localhost:9433");
				RemotingConfiguration.RegisterActivatedClientType (typeof(CaObject2), "http://localhost:9434");
				RemotingConfiguration.RegisterWellKnownClientType (typeof(WkObjectSinglecall1), "tcp://localhost:9433/wkoSingleCall1");
				RemotingConfiguration.RegisterWellKnownClientType (typeof(WkObjectSingleton1), "tcp://localhost:9433/wkoSingleton1");
				RemotingConfiguration.RegisterWellKnownClientType (typeof(WkObjectSinglecall2), "http://localhost:9434/wkoSingleCall2");
				RemotingConfiguration.RegisterWellKnownClientType (typeof(WkObjectSingleton2), "http://localhost:9434/wkoSingleton2");
			}
			catch (Exception ex)
			{
				Console.WriteLine (ex);
			}
		}
예제 #2
0
        } // HttpChannel

        public HttpChannel(IDictionary properties, 
                           IClientChannelSinkProvider clientSinkProvider,
                           IServerChannelSinkProvider serverSinkProvider)
        {
            Hashtable clientData = new Hashtable();
            Hashtable serverData = new Hashtable();
        
            // divide properties up for respective channels
            if (properties != null)
            {            
                foreach (DictionaryEntry entry in properties)
                {
                    switch ((String)entry.Key)
                    {
                    // general channel properties
                    case "name": _channelName = (String)entry.Value; break;
                    case "priority": _channelPriority = Convert.ToInt32((String)entry.Value, CultureInfo.InvariantCulture); break;
                    case "secure": _secure = Convert.ToBoolean(entry.Value, CultureInfo.InvariantCulture); 
                                    clientData["secure"] = entry.Value;
                                    serverData["secure"] = entry.Value;
                                    break;
                    default: 
                        clientData[entry.Key] = entry.Value;
                        serverData[entry.Key] = entry.Value;
                        break;
                    }
                }
            }

            _clientChannel = new HttpClientChannel(clientData, clientSinkProvider);
            _serverChannel = new HttpServerChannel(serverData, serverSinkProvider);
        } // HttpChannel
        } // HttpChannel

        public HttpChannel(IDictionary properties,
                           IClientChannelSinkProvider clientSinkProvider,
                           IServerChannelSinkProvider serverSinkProvider)
        {
            Hashtable clientData = new Hashtable();
            Hashtable serverData = new Hashtable();

            // divide properties up for respective channels
            if (properties != null)
            {
                foreach (DictionaryEntry entry in properties)
                {
                    switch ((String)entry.Key)
                    {
                    // general channel properties
                    case "name": _channelName = (String)entry.Value; break;

                    case "priority": _channelPriority = Convert.ToInt32((String)entry.Value, CultureInfo.InvariantCulture); break;

                    case "secure": _secure   = Convert.ToBoolean(entry.Value, CultureInfo.InvariantCulture);
                        clientData["secure"] = entry.Value;
                        serverData["secure"] = entry.Value;
                        break;

                    default:
                        clientData[entry.Key] = entry.Value;
                        serverData[entry.Key] = entry.Value;
                        break;
                    }
                }
            }

            _clientChannel = new HttpClientChannel(clientData, clientSinkProvider);
            _serverChannel = new HttpServerChannel(serverData, serverSinkProvider);
        } // HttpChannel
예제 #4
0
 public HttpChannel(int port)
 {
     this._channelPriority = 1;
     this._channelName     = "http";
     this._clientChannel   = new HttpClientChannel();
     this._serverChannel   = new HttpServerChannel(port);
 }
 public HttpChannel(int port)
 {
     this._channelPriority = 1;
     this._channelName = "http";
     this._clientChannel = new HttpClientChannel();
     this._serverChannel = new HttpServerChannel(port);
 }
        /// <summary>
        /// Start connection with specified engine interface
        /// </summary>
        /// <param name="typeEngineInterface">Type of engine interface</param>
        /// <param name="urlClient">Asscoiated URL</param>
        /// <param name="ensureSecurity">Remoting security attribute</param>
        public void Start(string urlClient, bool ensureSecurity, uint timeOut, Type iProxyType)
        {
            Trace.TraceInformation("Configuring client connection");

            _ensureSecurity = ensureSecurity;

            IDictionary t = new Hashtable();
            t.Add("timeout", timeOut);
            t.Add("name", urlClient);

            #if MONO
            _sinkProvider = new BinaryClientFormatterSinkProvider();
            #endif

            #if MONO
            /* MoMA moans about this line, but not clear why?
            Message	10	MonoTodo: void HttpClientChannel..ctor(IDictionary, IClientChannelSinkProvider)
            Reason: Handle the machineName, proxyName, proxyPort, servicePrincipalName, useAuthenticatedConnectionSharing properties	D:\Source\Projects\FluidEarth_Trunk\FluidEarth\SDK\src\ConnectionHttp.cs	148	14	PluginInterfaces
            */
            _channel = new HttpClientChannel(t, _sinkProvider);
            #else
            // need to make ChannelNames unique so need to use this
            // constructor even though we dont care about the sink provider
            _channel = new HttpClientChannel(t, _sinkProvider);
            #endif

            ChannelServices.RegisterChannel(_channel, _ensureSecurity);

            Trace.TraceInformation("Configured client connection");

            _base = (IBase)Activator.GetObject(iProxyType, urlClient);

            Trace.TraceInformation("Acquired proxy");
        }
예제 #7
0
        public static void PrepareGetService()
        {
            var clientChannel = new HttpClientChannel();
            ChannelServices.RegisterChannel(clientChannel, false);

            RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
        }
예제 #8
0
		public override MConnector Connect(String url, System.Collections.Specialized.NameValueCollection properties)
		{
			String[] parts = StripUrl(url);

			String formatter = parts[2];
			String objectUri = parts[3];
			String objectUrl = null;
			
			HttpClientChannel channel = new HttpClientChannel();

			try
			{
				ChannelServices.RegisterChannel( channel );
			}
			catch(RemotingException)
			{
				// Already registered
			}

			objectUrl = String.Format("{0}://{1}:{2}/{3}", 
				"http", GetHost(properties), GetPort(properties), objectUri);

			object ret = RemotingServices.Connect( typeof(MServer), objectUrl, null );

			return new MConnector( (MServer) ret, channel );
		}
 internal HttpClientTransportSink(HttpClientChannel channel, string channelURI)
 {
     this._channel    = channel;
     this._channelURI = channelURI;
     if (this._channelURI.EndsWith("/", StringComparison.Ordinal))
     {
         this._channelURI = this._channelURI.Substring(0, this._channelURI.Length - 1);
     }
 }
 internal HttpClientTransportSink(HttpClientChannel channel, string channelURI)
 {
     this._channel = channel;
     this._channelURI = channelURI;
     if (this._channelURI.EndsWith("/", StringComparison.Ordinal))
     {
         this._channelURI = this._channelURI.Substring(0, this._channelURI.Length - 1);
     }
 }
예제 #11
0
 public ConfigurationWizard()
 {
     InitializeComponent();
     pastPanels = new ArrayList();
     pastPanels.Add(mainPanel);
     currentPanel = mainPanel;
     HttpClientChannel chan = new HttpClientChannel();
     ChannelServices.RegisterChannel(chan, false);
 }
        } // HttpChannel

        /// <include file='doc\CombinedHttpChannel.uex' path='docs/doc[@for="HttpChannel.HttpChannel2"]/*' />
        public HttpChannel(IDictionary properties,
                           IClientChannelSinkProvider clientSinkProvider,
                           IServerChannelSinkProvider serverSinkProvider)
        {
            Hashtable clientData = new Hashtable();
            Hashtable serverData = new Hashtable();

            // divide properties up for respective channels
            if (properties != null)
            {
                foreach (DictionaryEntry entry in properties)
                {
                    switch ((String)entry.Key)
                    {
                    // general channel properties
                    case "name": _channelName = (String)entry.Value; break;

                    case "priority": _channelPriority = Convert.ToInt32((String)entry.Value); break;

                    // client properties
                    case "clientConnectionLimit": clientData["clientConnectionLimit"] = entry.Value; break;

                    case "proxyName": clientData["proxyName"] = entry.Value; break;

                    case "proxyPort": clientData["proxyPort"] = entry.Value; break;

                    case "timeout": clientData["timeout"] = entry.Value; break;

                    case "useDefaultCredentials": clientData["useDefaultCredentials"] = entry.Value; break;

                    case "useAuthenticatedConnectionSharing": clientData["useAuthenticatedConnectionSharing"] = entry.Value; break;

                    // server properties
                    case "bindTo": serverData["bindTo"] = entry.Value; break;

                    case "listen": serverData["listen"] = entry.Value; break;

                    case "machineName": serverData["machineName"] = entry.Value; break;

                    case "port": serverData["port"] = entry.Value; break;

                    case "suppressChannelData": serverData["suppressChannelData"] = entry.Value; break;

                    case "useIpAddress": serverData["useIpAddress"] = entry.Value; break;

                    case "exclusiveAddressUse": serverData["exclusiveAddressUse"] = entry.Value; break;

                    default:
                        break;
                    }
                }
            }

            _clientChannel = new HttpClientChannel(clientData, clientSinkProvider);
            _serverChannel = new HttpServerChannel(serverData, serverSinkProvider);
        } // HttpChannel
예제 #13
0
        } // HttpChannel

        /// <include file='doc\CombinedHttpChannel.uex' path='docs/doc[@for="HttpChannel.HttpChannel2"]/*' />
        public HttpChannel(IDictionary properties,
                           IClientChannelSinkProvider clientSinkProvider,
                           IServerChannelSinkProvider serverSinkProvider)
        {
            Hashtable clientData = new Hashtable();
            Hashtable serverData = new Hashtable();

            // divide properties up for respective channels
            if (properties != null)
            {
                foreach (DictionaryEntry entry in properties)
                {
                    switch ((String)entry.Key)
                    {
                    // general channel properties
                    case "name": _channelName = (String)entry.Value; break;

                    case "priority": _channelPriority = Convert.ToInt32((String)entry.Value); break;

                    // client properties
                    case "clientConnectionLimit": clientData["clientConnectionLimit"] = entry.Value; break;

                    case "proxyName": clientData["proxyName"] = entry.Value; break;

                    case "proxyPort": clientData["proxyPort"] = entry.Value; break;

                    case "useDefaultCredentials": clientData["useDefaultCredentials"] = entry.Value; break;

                    // server properties
                    case "bindTo": serverData["bindTo"] = entry.Value; break;

                    case "listen": serverData["listen"] = entry.Value; break;

                    case "machineName": serverData["machineName"] = entry.Value; break;

                    case "port": serverData["port"] = entry.Value; break;

                    case "suppressChannelData": serverData["suppressChannelData"] = entry.Value; break;

                    case "useIpAddress": serverData["useIpAddress"] = entry.Value; break;

                    default:
                        throw new ArgumentException(
                                  String.Format(
                                      CoreChannel.GetResourceString(
                                          "Remoting_Channels_BadCtorArgs"),
                                      entry.Key));
                    }
                }
            }

            _clientChannel = new HttpClientChannel(clientData, clientSinkProvider);
            _serverChannel = new HttpServerChannel(serverData, serverSinkProvider);
        } // HttpChannel
예제 #14
0
		public HttpChannel (IDictionary properties,
			IClientChannelSinkProvider clientSinkProvider,
			IServerChannelSinkProvider serverSinkProvider)
		{
			if (properties != null && properties.Contains ("name")) {
				this.name = (string)properties["name"];
			}

			client = new HttpClientChannel (properties, clientSinkProvider);
			server = new HttpServerChannel (properties, serverSinkProvider);
		}
예제 #15
0
        internal HttpClientTransportSink(HttpClientChannel channel, String channelURI) : base()
        {
            _channel = channel;

            _channelURI = channelURI;

            // make sure channel uri doesn't end with a slash.
            if (_channelURI.EndsWith("/", StringComparison.Ordinal))
            {
                _channelURI = _channelURI.Substring(0, _channelURI.Length - 1);
            }
        } // HttpClientTransportSink
예제 #16
0
        public HttpChannel(IDictionary properties,
                           IClientChannelSinkProvider clientSinkProvider,
                           IServerChannelSinkProvider serverSinkProvider)
        {
            if (properties != null && properties.Contains("name"))
            {
                this.name = (string)properties["name"];
            }

            client = new HttpClientChannel(properties, clientSinkProvider);
            server = new HttpServerChannel(properties, serverSinkProvider);
        }
예제 #17
0
		private void SetupChannel (IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider)
		{
			clientChannel = new HttpClientChannel (properties, clientSinkProvider);
			serverChannel = new HttpServerChannel (properties, serverSinkProvider);
			
			object val = properties ["name"];
			if (val != null) channelName = val as string;
			
			val = properties ["priority"];
			if (val != null) channelPriority = Convert.ToInt32 (val);
			
			this.properties = new AggregateDictionary (new IDictionary[] {clientChannel, serverChannel});
		}
예제 #18
0
        public HttpChannel(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider)
        {
            this._channelPriority = 1;
            this._channelName     = "http";
            Hashtable hashtable  = new Hashtable();
            Hashtable hashtable2 = new Hashtable();

            if (properties != null)
            {
                foreach (DictionaryEntry entry in properties)
                {
                    string key = (string)entry.Key;
                    if (key == null)
                    {
                        goto Label_00F4;
                    }
                    if (!(key == "name"))
                    {
                        if (key == "priority")
                        {
                            goto Label_0099;
                        }
                        if (key == "secure")
                        {
                            goto Label_00B7;
                        }
                        goto Label_00F4;
                    }
                    this._channelName = (string)entry.Value;
                    continue;
Label_0099:
                    this._channelPriority = Convert.ToInt32((string)entry.Value, CultureInfo.InvariantCulture);
                    continue;
Label_00B7:
                    this._secure         = Convert.ToBoolean(entry.Value, CultureInfo.InvariantCulture);
                    hashtable["secure"]  = entry.Value;
                    hashtable2["secure"] = entry.Value;
                    continue;
Label_00F4:
                    hashtable[entry.Key]  = entry.Value;
                    hashtable2[entry.Key] = entry.Value;
                }
            }
            this._clientChannel = new HttpClientChannel(hashtable, clientSinkProvider);
            this._serverChannel = new HttpServerChannel(hashtable2, serverSinkProvider);
        }
 public HttpChannel(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider)
 {
     this._channelPriority = 1;
     this._channelName = "http";
     Hashtable hashtable = new Hashtable();
     Hashtable hashtable2 = new Hashtable();
     if (properties != null)
     {
         foreach (DictionaryEntry entry in properties)
         {
             string key = (string) entry.Key;
             if (key == null)
             {
                 goto Label_00F4;
             }
             if (!(key == "name"))
             {
                 if (key == "priority")
                 {
                     goto Label_0099;
                 }
                 if (key == "secure")
                 {
                     goto Label_00B7;
                 }
                 goto Label_00F4;
             }
             this._channelName = (string) entry.Value;
             continue;
         Label_0099:
             this._channelPriority = Convert.ToInt32((string) entry.Value, CultureInfo.InvariantCulture);
             continue;
         Label_00B7:
             this._secure = Convert.ToBoolean(entry.Value, CultureInfo.InvariantCulture);
             hashtable["secure"] = entry.Value;
             hashtable2["secure"] = entry.Value;
             continue;
         Label_00F4:
             hashtable[entry.Key] = entry.Value;
             hashtable2[entry.Key] = entry.Value;
         }
     }
     this._clientChannel = new HttpClientChannel(hashtable, clientSinkProvider);
     this._serverChannel = new HttpServerChannel(hashtable2, serverSinkProvider);
 }
예제 #20
0
파일: Form1.cs 프로젝트: banyaai/PUS
 private void button1_Click_1(object sender, EventArgs e)
 {
     string adres = textBox1.Text;
     adres = "http://" + adres;
     int port = Convert.ToInt32(textBox2.Text);
     HttpClientChannel kanal = null;
     try
     {
         kanal = new HttpClientChannel();
         ChannelServices.RegisterChannel(kanal, false);
         ZdalnyObiekt obiekt = (ZdalnyObiekt)Activator.GetObject(typeof(ZdalnyObiekt), adres + ":" + port.ToString() +
             "/NazwaUslugiProjektu");
         listBox1.Items.Add(obiekt.ZwrocTekst(textBox3.Text, textBox4.Text));
         ChannelServices.UnregisterChannel(kanal);
         listBox1.Items.Add("polaczenie zostalo zakonczone");
     }
     catch (Exception ext)
     {
         MessageBox.Show(ext.Message, "blad");
         listBox1.Items.Add("blad polaczenia");
         ChannelServices.UnregisterChannel(kanal);
     }
 }
예제 #21
0
        void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup

            // server registration using http
            IDictionary properties = new Hashtable();
            properties["machineName"] = Properties.Settings.Default.hMailServerWebAdminMachineName;
            HttpServerChannel channel = new HttpServerChannel(properties, null);
            ChannelServices.RegisterChannel(channel, false);

            LifetimeServices.LeaseTime = TimeSpan.FromMinutes(10);
            LifetimeServices.RenewOnCallTime = TimeSpan.FromMinutes(15);

            RemotingConfiguration.RegisterWellKnownServiceType(new WellKnownServiceTypeEntry(
               typeof(hMailServerNetRemote.ClassFactory),
               "Remote.soap",
               WellKnownObjectMode.SingleCall
            ));

            // client registration (for calling a server) using http
            BinaryClientFormatterSinkProvider clnt = new BinaryClientFormatterSinkProvider();
            HttpClientChannel client = new HttpClientChannel((IDictionary) null, clnt);
            ChannelServices.RegisterChannel(client, false);
        }
예제 #22
0
		public HttpChannel (int port)
		{
			client = new HttpClientChannel ();
			server = new HttpServerChannel (port);
		}
예제 #23
0
        } // HttpChannel

        /// <include file='doc\CombinedHttpChannel.uex' path='docs/doc[@for="HttpChannel.HttpChannel1"]/*' />
        public HttpChannel(int port)
        {
            _clientChannel = new HttpClientChannel();
            _serverChannel = new HttpServerChannel(port);
        } // HttpChannel
예제 #24
0
        } // HttpChannel

        /// <include file='doc\CombinedHttpChannel.uex' path='docs/doc[@for="HttpChannel.HttpChannel2"]/*' />
        public HttpChannel(IDictionary properties, 
                           IClientChannelSinkProvider clientSinkProvider,
                           IServerChannelSinkProvider serverSinkProvider)
        {
            Hashtable clientData = new Hashtable();
            Hashtable serverData = new Hashtable();
        
            // divide properties up for respective channels
            if (properties != null)
            {            
                foreach (DictionaryEntry entry in properties)
                {
                    switch ((String)entry.Key)
                    {
                    // general channel properties
                    case "name": _channelName = (String)entry.Value; break;
                    case "priority": _channelPriority = Convert.ToInt32((String)entry.Value); break;

                    // client properties
                    case "clientConnectionLimit": clientData["clientConnectionLimit"] = entry.Value; break;
                    case "proxyName": clientData["proxyName"] = entry.Value; break;
                    case "proxyPort": clientData["proxyPort"] = entry.Value; break;
                    case "useDefaultCredentials": clientData["useDefaultCredentials"] = entry.Value; break;

                    // server properties
                    case "bindTo": serverData["bindTo"] = entry.Value; break;
                    case "listen": serverData["listen"] = entry.Value; break; 
                    case "machineName": serverData["machineName"] = entry.Value; break; 
                    case "port": serverData["port"] = entry.Value; break;
                    case "suppressChannelData": serverData["suppressChannelData"] = entry.Value; break;
                    case "useIpAddress": serverData["useIpAddress"] = entry.Value; break;

                    default: 
                         throw new ArgumentException(
                            String.Format(
                                CoreChannel.GetResourceString(
                                    "Remoting_Channels_BadCtorArgs"),
                                entry.Key));
                    }
                }
            }

            _clientChannel = new HttpClientChannel(clientData, clientSinkProvider);
            _serverChannel = new HttpServerChannel(serverData, serverSinkProvider);
        } // HttpChannel
예제 #25
0
 public HttpClientTransportSink(HttpClientChannel channel, string url)
 {
     this.channel = channel;
     this.url     = url;
 }
 internal HttpClientTransportSink(HttpClientChannel channel, String channelURI) : base()
 {
     _channel = channel;
 
     _channelURI = channelURI;
     
     // make sure channel uri doesn't end with a slash.
     if (_channelURI.EndsWith("/", StringComparison.Ordinal))
         _channelURI = _channelURI.Substring(0, _channelURI.Length - 1);
         
 } // HttpClientTransportSink
예제 #27
0
		public HttpClientTransportSink (HttpClientChannel channel, string url)
		{
			this.channel = channel;
			this.url = url;
		}
//		private bool _useKeepAlive = true;

		internal HttpClientTransportSink(HttpClientChannel channel, String channelURI) : base()
		{
			string dummy;
			_channel = channel;
   			_channelURI = HttpHelper.Parse(channelURI,out dummy);
		} 
예제 #29
0
		[Category ("NotWorking")] // disabled as it got not working by NUnit upgrade to 2.4.8
		public void MultiClientConnection ()
		{
			int num_clients = 20;
			
			Hashtable options = new Hashtable ();
			options ["timeout"] = 10000; // 10s
			options ["name"] = "MultiClientConnection"; // 10s
			HttpClientChannel clientChannel = new HttpClientChannel (options, null);
			ChannelServices.RegisterChannel (clientChannel);
			try {
			
			WellKnownClientTypeEntry remoteType = new WellKnownClientTypeEntry (
				typeof (RemoteObject), "http://127.0.0.1:9090/RemoteObject.rem");
			RemotingConfiguration.RegisterWellKnownClientType (remoteType);
			
			// start a bunch of clients...
			Thread []clients = new Thread [num_clients];
			retvals = new bool [num_clients];
			
			lock (mutex) {
				for (int i = 0; i < num_clients; i++) {
					clients[i] = new Thread (MultiClientStart);
					clients[i].Start ();
					retvals[i] = false;
				}
			}
			
			// wait for all clients to finish...
			for (int i = 0; i < num_clients; i++)
				clients[i].Join ();
			
			for (int i = 0; i < num_clients; i++)
				Assert.IsTrue (retvals[i], "RemoteObject.Incrememnt() didn't return a value of " + i);

			} finally {
			ChannelServices.UnregisterChannel (clientChannel);
			}
		}
예제 #30
0
 public HttpChannel()
 {
     client = new HttpClientChannel();
     server = new HttpServerChannel();
 }
예제 #31
0
		public HttpChannel ()
		{
			client = new HttpClientChannel ();
			server = new HttpServerChannel ();
		}
예제 #32
0
파일: Client.cs 프로젝트: cbguder/practises
        private bool Connect()
        {
            HttpClientChannel chan = new HttpClientChannel();
            ChannelServices.RegisterChannel(chan, false);

            Console.Error.WriteLine("Connecting to PractiSES server ({0})...", host);

            server = (IServer) Activator.GetObject(typeof (IServer), "http://" + host + "/PractiSES");

            return true;
        }
        } // HttpChannel

        public HttpChannel(int port)
        {
            _clientChannel = new HttpClientChannel();
            _serverChannel = new HttpServerChannel(port);
        } // HttpChannel
예제 #34
0
 public HttpChannel(int port)
 {
     client = new HttpClientChannel();
     server = new HttpServerChannel(port);
 }