Archived Forum Post

Index of archived forum posts

Question:

HTTP AbortCheck problem

Mar 14 '13 at 05:35

Sorry for the email Matt I'd completely forgotten about this forum !

Just trying this AbortCheck call back again and it is working however the HeartbeatMs is having no effect unless I ham misunderstanding the use

Here is the simple class from my VDF code. See comment

Thanks in advance

Andrew

Class cGovTalkHTTP is a cComChilkatHttp

Procedure End_Construct_Object
    Forward Send End_Construct_Object
    Boolean bOK
    Get ComUnlockComponent UNLOCK_CHILKAT_HTTP to bOK
    //Set ComHeartbeatMs to 5432
    Set ComHeartbeatMs to 65432
End_Procedure

Procedure OnComAbortCheck Integer ByRef llabort
    Integer i
    Get ComHeartbeatMs to I  // I shows the value I have set above BUT  OnComAbortCheck is called way more than every 5 seconds or 65 seconds...Like several times a second. Infact it is still called even if I don’t set HeatbeatMs
End_Procedure

End_Class


Answer

Andrew,

The HeartbeatMs property, which is common to any object/class that has an AbortCheck event callback, indicates the frequency of the AbortCheck callbacks. If set to 0 (the default), then no AbortCheck callbacks will happen. If set to 10, for example, then AbortCheck callbacks will happen approximately every 10 milliseconds. Your code is setting the HeartbeatMs property equal to 65432, which means that AbortCheck will be called very 65.432 seconds..


Answer

Hi Matt

Yes this is what I was expecting from your documentation but not what i'm seeing.

Basically the setting of HeartbeatMs is having NO effect at all and the AbortCheck is called many times a second ... even when I set it to zero

Thanks


Answer

Thanks Matt

Just resent a copy with same subj as this thread to cknotes address


Answer

You posted some code, but it does not actually show what method you are calling. For example, are you calling the Download method? Is it SynchronousRequest? Which of the many methods that send an HTTP request are you calling? That's the code I would need to see.


Answer

Hi Matt

Hopefully this contains all the code snips you need to see ...

Class cHTTP is a cComChilkatHttp

Procedure Construct_Object
    Forward Send Construct_Object
End_Procedure

Procedure End_Construct_Object
    Forward Send End_Construct_Object
    Boolean bOK
    Get ComUnlockComponent UNLOCK_CHILKAT_HTTP to bOK
    Set ComHeartbeatMs to 65432
End_Procedure

Procedure OnComAbortCheck Integer ByRef llabort
    // hook so you can update "we are still going" status
    Send OnAbortCheckCallback 
End_Procedure

End_Class


Object oHTTP is a cHTTP
End_Object

Object oHTTPResponse is a cComChilkatHttpResponse
End_Object

Function GatewayCall String ByRef sLastErrorText Returns Integer
    Integer iSuccess iStatusCode 
    Boolean bOK
    Variant vResponse

    Get ComUnlockComponent  of oHTTP UNLOCK_CHILKAT_HTTP to bOK

    If (bOK) Begin 
        Get ComPostXml of oHTTP (psServiceURL(Self)) (psXML(phoMessageXML(Self))) "utf-8" to vResponse

        If (IsNullComObject(vResponse)) Begin 
            Get ComLastErrorText of oHTTP to sLastErrorText
        End
        Else Begin 
            Set pvComObject of oHTTPResponse to vResponse
            Get ComStatusCode of oHTTPResponse to iStatusCode
            If (iStatusCode=HTTP_OK) Begin 
                Get ComBodyStr of oHTTPResponse to sLastErrorText        
            End
            Else Begin 
                Get ComLastErrorText of oHTTP to sLastErrorText
            End
        End
    End
    Function_Return iStatusCode
End_Function

Answer

Check to see if this new build has the same issue: http://www.chilkatsoft.com/preRelease/ChilkatHttp.zip


Answer

Hi Matt I'm not seeing any difference

The AbortCheck is still called many times even if HeatBeat is set to 0 and the heart beat value seems to be ignored

The DllDate in LastError is March 11

If I set it to 0 the Last error text contains IPV6 enabled connect with NO heartbeat.

If I set it to 5000 That line does not appear but no line contains 5000 or the word heartbeat

Thanks in advance


Answer

I understand the problem now. In other Chilkat ActiveX's the PercentDone event includes an argument for setting an abort flag. This is the case for the HTTP API in other programming languages. However, w/ the ActiveX the PercentDone event did not include the abort argument, and therefore to make it compatible, each PercentDone event is followed with an AbortCheck event. Therefore, in this particular case, the HeartbeatMs property controls AbortCheck events in general, except for those triggered by PercentDone. This is not something that can change, at least for now. The reason is that the ActiveX API cannot change because it would affect other programs that might be depending on it (known as DLL Hell where a DLL is updated and adversely affects existing programs).

The solution is for your application to simply ignore those AbortCheck callbacks. There shouldn't be more than 100 of them for any given HTTP request/response.


Answer

Thanks for the explanation Matt. Thats fine. Knowing that gives me the option to ignore it completly or simply increment a couter to know we are still moving etc