C#之tcp自动更新程序

.NETTCP自动更新程序有如下几步骤:

第一步:服务端开启监听

ServiceHost host;
        private void button1_Click(object sender, EventArgs e)
        {
            host = new ServiceHost(typeof(WCFService.Service));
            host.Open();
            if (host.State == CommunicationState.Opened)
            {
                this.button1.Enabled = false;
                this.button2.Enabled = true;
            }
            this.label1.Text = host.State.ToString();
        }
View Code

相关文章: