示例#1
0
 private void Form1_Load(object sender, EventArgs e)
 {
     ServerHost.parentForm = this;                              //初始化变量
     ServerHost.Start();                                        //监听开始
     new Task(() => ServerHost.Listen()).Start();               //利用Task创建多线程
     ServerHost.EventImageRecieved += ViewerForm_UpdatePicture; //给回调参数赋值
 }
示例#2
0
        static void Main(string[] args)
        {
            ServerHost sh = new ServerHost();

            sh.Start();
            Console.WriteLine("Press any key to stop server....");
            Console.ReadLine();
            sh.Stop();
        }