Example #1
0
        private Client Init(EndpointAddress addr)
        {
            if (infoFactory == null)
            {
                NetTcpBinding netTcpBinding = new NetTcpBinding(SecurityMode.None);
                netTcpBinding.ReliableSession.Enabled           = true;
                netTcpBinding.ReliableSession.InactivityTimeout = new TimeSpan(1, 0, 0);
                netTcpBinding.ReceiveTimeout = new TimeSpan(0, 10, 0);
                netTcpBinding.SendTimeout    = new TimeSpan(0, 0, 10);
                netTcpBinding.OpenTimeout    = new TimeSpan(0, 0, 10);

                this.infoFactory = new ChannelFactory <IExtDataService>(netTcpBinding, addr);
            }

            this.infoFactory.Open();
            this.client = infoFactory.CreateChannel();

            try
            {
                this.client.Reset(this.MyClientId);
            }
            catch (Exception)
            {
                this.infoFactory.Abort();
                return(null);
            }

            return(this);
        }
Example #2
0
        public void Dispose()
        {
            if (this.infoFactory != null)
            {
                this.client.Reset(this.MyClientId);
                this.infoFactory.Abort();

                this.infoFactory = null;
                this.client      = null;
            }
        }