示例#1
0
 /// <summary>
 /// 向浏览器发送头部信息
 /// </summary>
 /// <param name="client"></param>
 /// <param name="httpVersion"></param>
 /// <param name="mimeHeader"></param>
 /// <param name="len"></param>
 /// <param name="statusCode"></param>
 public void SendHeader(Client client, string httpVersion, string mimeHeader, int len, string statusCode)
 {
     TCPManager tcpManager = new TCPManager();
     string value = string.Empty;
     if (mimeHeader.Length == 0)
     {
         mimeHeader = "text/html";
     }
     value += httpVersion + " " + statusCode + "\r\n";
     value += "Server:winwolf\r\n";
     value += "Content-Type:" + mimeHeader + "\r\n";
     value += "Accept-Ranges:bytes\r\n";
     value += "Content-Length:" + len + "\r\n\r\n";
     byte[] buf = Encoding.UTF8.GetBytes(value);
     tcpManager.SendMessage(client, buf);
 }
示例#2
0
 /// <summary>
 /// 将信息发送给浏览器
 /// </summary>
 /// <param name="client"></param>
 /// <param name="buf"></param>
 public void SendToBroswer(Client client, byte[] buf)
 {
     TCPManager tcpManager = new TCPManager();
     tcpManager.SendMessage(client, buf);
 }