Пример #1
0
        public LightHttpApplication(Socket newSocket, DelShowMsg delShowMsg)
        {
            this._newSocket  = newSocket;
            this._delShowMsg = delShowMsg;

            byte[] buffer = new byte[1024 * 1024 * 2];
            // 真实接收到的实际内容大小(因为不足buffer的大小时,会用0填充buffer)
            int receiveContentSize = _newSocket.Receive(buffer);

            if (receiveContentSize <= 0)
            {
                return;
            }
            // 只解码实际内容大小
            string msg = Encoding.UTF8.GetString(buffer, 0, receiveContentSize);

            // 展示接收到的请求报文
            _delShowMsg(msg);
            // 请求
            LightHttpRequest request = new LightHttpRequest(msg);

            // 处理请求
            ProcessRequest(request);
        }
Пример #2
0
 public Form2(DelShowMsg del)
 {
     this._del = del;
     InitializeComponent();
 }