SHARE
TWEET

Untitled

a guest Jun 27th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ifstream f(text);
  2.             if (f.good())
  3.             {
  4.                 string str((istreambuf_iterator<char>(f)), istreambuf_iterator<char>());
  5.                 answer = str;
  6.                 code = 200;
  7.             }
  8.             f.close();
  9.      
  10. ostringstream response << "HTTP/1.1 " << code << " OKrn" // code - 200 или 404
  11.                 << "Version: HTTP / 1.1rn"
  12.                 << "Content-Type: " << s // запрашиваемый файл
  13.                 << "Content-Length: " << answer.length() // длина строки
  14.                 << "rnrn"
  15.                 << answer; // строка для чтения
  16.  
  17. send(client_socket, response.str().c_str(), response.str().length(), 0);
  18.      
  19. s = "image/jpeg;rn";
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top