Login Page - Create Account

Support Board


Date/Time: Sun, 19 May 2024 03:48:21 +0000



Post From: Problems with ACSIL HTTP Support

[2016-01-10 02:39:09]
managematics - Posts: 3
I am attempting to move one of my studies to Sierra Chart and it requires that I retrieve two different files from my server. However, I have found that when I attempt this, sc.HTTPResponse will often contain the contents of a previously fetched file. Here is a small test study that shows the problem:

#include "sierrachart.h"

SCDLLName("HTTP Test")

SCSFExport scsf_HTTPTest(SCStudyGraphRef sc)
{
    SCString URL1="http://www.fwtrader.com/voodoo/a.txt";
    SCString URL2="http://www.fwtrader.com/voodoo/b.txt";
    SCString msg;
    sc.FreeDLL = 1;
    sc.AutoLoop = 1;
    
  
  if (sc.Index == 0)
  {
    if(!sc.MakeHTTPRequest(URL1))
    {
      sc.AddMessageToLog("Error requesting file a",true);
    }
    else
    {
      msg.Format("response a: %s", sc.HTTPResponse.GetChars());
      sc.AddMessageToLog(msg, true);
    }
    
    if(!sc.MakeHTTPRequest(URL2))
    {
      sc.AddMessageToLog("Error requesting file b",true);
    }
    else
    {
      msg.Format("response b: %s", sc.HTTPResponse.GetChars());
      sc.AddMessageToLog(msg,true);
    }
        sc.HTTPResponse = "";
  }
}


And here is the section of the log file which shows the result:

US30 [C] 1 Min #2 | Reloading chart. | 2016-01-09 20:25:40
US30 [C] 5 Min #2 | No contract months found for symbol. Unable to build continuous futures contract chart. | 2016-01-09 20:25:40
US30 [C] 5 Min #2 | There are no continuous futures contract symbols. Loading data normally. | 2016-01-09 20:25:40
US30 [C] 5 Min #2 | Study: Custom DLL Study | Making HTTP request. | 2016-01-09 20:25:41
Chart: US30 [C] 5 Min #2 | Study: Custom DLL Study | response a: File B this is. | 2016-01-09 20:25:41 *
US30 [C] 5 Min #2 | Study: Custom DLL Study | Making HTTP request. | 2016-01-09 20:25:41
Chart: US30 [C] 5 Min #2 | Study: Custom DLL Study | response b: File B this is. | 2016-01-09 20:25:41 *
HTTP connection to www.fwtrader.com:80 (0) | Resolved address www.fwtrader.com to IP 74.208.30.141 | 2016-01-09 20:25:41
HTTP connection to www.fwtrader.com:80 (138) | Connected. | 2016-01-09 20:25:41
HTTP connection to www.fwtrader.com:80 (138) | Closed. No error. | 2016-01-09 20:25:43
HTTP connection to www.fwtrader.com:80 (138) | Shutdown and closed. | 2016-01-09 20:25:43


The files a.txt and b.txt each have a single line of content which identifies them. But you can see that although the study attempts to fetch two different files, after each sc.HTTPResponse only has the content of b.txt.

Can you provide any guidance?
Date Time Of Last Edit: 2016-01-10 02:40:30