示例#1
0
        static void GetContextCallBack(IAsyncResult ar)
        {
            try {
                ServerCtl    ctl     = ar.AsyncState as ServerCtl;
                HttpListener sSocket = ctl.httpListener;
                if (sSocket == null || !sSocket.IsListening)
                {
                    return;
                }
                HttpListenerContext context = sSocket.EndGetContext(ar);

                sSocket.BeginGetContext(new AsyncCallback(GetContextCallBack), ctl);

                ctl.responseFile(context);
            } catch (Exception ex) {
                MainWindow.ins.error(ex);
            }
        }