Exemplo n.º 1
0
        public TrackerRec()
        {
            InitializeComponent();
            System.Environment.SetEnvironmentVariable("NLS_LANG", " SIMPLIFIED CHINESE_CHINA.ZHS16GBK");
            ThreadPool.QueueUserWorkItem(new WaitCallback((m) =>
            {
                rec             = new UdpClient(Convert.ToInt32(Properties.Resources.本地端口.ToString()));
                IPEndPoint from = null;

                BackgroundService bService = new BackgroundService();
                while (true)
                {
                    byte[] b   = rec.Receive(ref from);
                    string str = Encoding.UTF8.GetString(b, 0, b.Length);

                    ThreadPool.QueueUserWorkItem(new WaitCallback((sp) =>
                    {
                        bService.Oper((string)sp);
                    }), str);
                }
            }));
        }