コード例 #1
0
ファイル: ProxySingletone.cs プロジェクト: 8ezhikov/Git4Life
        public bool Connect(ClientCrawlerInfo clientCrawlerInfo)
        {
            try
            {
                var site = new InstanceContext(this);

                var binding = new NetTcpBinding(SecurityMode.None);
                //var address = new EndpointAddress("net.tcp://localhost:22222/chatservice/");

                var address = new EndpointAddress("net.tcp://193.124.113.235:22222/chatservice/");
                var factory = new DuplexChannelFactory<IRemoteCrawler>(site, binding, address);

                proxy = factory.CreateChannel();
                ((IContextChannel)proxy).OperationTimeout = new TimeSpan(1, 0, 10);

                clientCrawlerInfo.ClientIdentifier = _singletoneId;
                proxy.Join(clientCrawlerInfo);

                return true;
            }

            catch (Exception ex)
            {
                MessageBox.Show("Error happened" + ex.Message);
                return false;
            }
        }
コード例 #2
0
 public void AddCrawler(IRemoteCrawler crawler)
 {
     crawler.Initialize(this);
     this._crawlers.Add(crawler);
 }
コード例 #3
0
 public void AddCrawler(IRemoteCrawler crawler)
 {
     crawler.Initialize(this);
     this._crawlers.Add(crawler);
 }