Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Error in downloading Image using boost library.

New Here ,
Sep 12, 2016 Sep 12, 2016

Hi All,

    We are trying to download the image file from the server using Indesign boost libraries(Indesign CC2014 sdk). But it throws "read_until: End of file" exception. Please help me If anybody has tried it. My Code snippet is as below -

{

  boost::asio::io_service io_service;

  // Get a list of endpoints corresponding to the server name.

  tcp::resolver resolver(io_service);

  tcp::resolver::query query(serverName, sPortNo);

  tcp::resolver::iterator endpoint_iterator = resolver.resolve(query);

  tcp::resolver::iterator end;

  // Try each endpoint until we successfully establish a connection.

  tcp::socket socket(io_service);

  boost::system::error_code error = boost::asio::error::host_not_found;

  while (error && endpoint_iterator != end)

  {

  socket.close();

  socket.connect(*endpoint_iterator++, error);

  }

  boost::asio::streambuf request;

  std::ostream request_stream(&request);

  request_stream << "GET " << assetUrl << " HTTP/1.1\r\n";

  request_stream << "Host: " << serverName << ":" << sPortNo << "\r\n";

  request_stream << "Connection: close\r\n";

  request_stream << "Accept: */*\r\n";

  request_stream << "Cookie: JSESSIONID=" << sTokenkey << "\r\n\r\n";

  // Send the request.

  int bytesSent = (int)boost::asio::write(socket, request);

  // Read the response status line.

  boost::asio::streambuf response;

  boost::asio::read_until(socket, response, "\r\n");  // throws an exception at this point.

}

Thanks all in advance.

Regards,

Siddhesh

TOPICS
Scripting
332
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Sep 12, 2016 Sep 12, 2016
LATEST

Moving to InDesign Scripting​ for further assistance.

Regards,

Om

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines