Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » HTTP - Initialization (Once an INIT event is sent to the CLIENT FB it apparently doesn't update new ID strings.)
HTTP - Initialization [message #1863969] Fri, 08 March 2024 12:01 Go to next message
roger giglio is currently offline roger giglioFriend
Messages: 11
Registered: August 2023
Junior Member
Hi! I am currently using HTTP for communication. In my application I was trying to initialize the same Client FB with different parameters on each request (PARAM=value1, PARAM=value2, etc). However what i noted is that once the FB is initialized with the first string it somehow keeps its information and doesn't update new ones., even if it receives a new INIT event.

Is this the expected behavior?

What i had to do is to reinitialize with a FALSE value in Q input in order to "reset" the FB. Then on next INIT event it accepts again the changes on ID input.

Any comments would be appreciated.

I am using Forte 2.0.1, IDE 2.0.1 and Ubuntu 22.04 LTS.
Re: HTTP - Initialization [message #1863976 is a reply to message #1863969] Fri, 08 March 2024 15:28 Go to previous messageGo to next message
Monika Wenger is currently offline Monika WengerFriend
Messages: 5
Registered: March 2020
Junior Member
hi, i updated the HTTP client on the develop branch within the github repository of forte. The changes should support your use case, since the parameters are now provided through the second SD input. Maybe this documentation explains it: https://github.com/eclipse-4diac/4diac-documentation/blob/main/src/communication/http.adoc
Re: HTTP - Initialization [message #1863977 is a reply to message #1863969] Fri, 08 March 2024 15:28 Go to previous messageGo to next message
Monika Wenger is currently offline Monika WengerFriend
Messages: 5
Registered: March 2020
Junior Member
hi, i updated the HTTP client on the develop branch within the github repository of forte. The changes should support your use case, since the parameters are now provided through the second SD input. Maybe this documentation explains it: https://github.com/eclipse-4diac/4diac-documentation/blob/main/src/communication/http.adoc
Re: HTTP - Initialization [message #1864055 is a reply to message #1863977] Wed, 13 March 2024 17:39 Go to previous messageGo to next message
roger giglio is currently offline roger giglioFriend
Messages: 11
Registered: August 2023
Junior Member
Thank you Monika! It worked!

However I have some more questions:

1. What is the standard timeout for generating the ERROR message: "Timeout at client".

2. Is there a way to increase this value?

3. When the HTTP handler detects a timeout ERROR it apparently freezes and don't generate a CNF event. Is this behavior expected?

4. Using the FB E_STOPWATCH in order to measure the time between an REQ and CNF event for a get requisition (on a local server) the average time for a response is around 150ms. I suspect this is a long time and probably I am doing something wrong. However I am just using one FB_CLIENT_3_2 and nothing more.

I am sending a picture of my test application.

Thanks in advance!

[Updated on: Wed, 13 March 2024 23:16]

Report message to a moderator

Re: HTTP - Initialization [message #1864110 is a reply to message #1864055] Sun, 17 March 2024 02:28 Go to previous messageGo to next message
roger giglio is currently offline roger giglioFriend
Messages: 11
Registered: August 2023
Junior Member
Hi!

I was getting a lot of "timeou at client X" when trying to do requisitions.

After looking in the code i found out the checkClientLayers method has the following method statement:

if(currentTime.getMilliSeconds() - (*iter)->mStartTime.getMilliSeconds() > scmSendTimeout * 1000) {
(...)
DEVLOG_ERROR("[HTTP Handler]: Timeout at client %s:%u \n", (*iter)->mLayer->getHost().c_str(), (*iter)->mLayer->getPort());
(...)
}

As the variables inside IF loop seems to be of type UINT if the subtraction would give a negative result it would be interpreted as an big value and the program generates an timeout error.

I have changed the line according to the code below:

f(currentTime.getMilliSeconds() > (*iter)->mStartTime.getMilliSeconds() + scmSendTimeout * 1000) {
(...)
DEVLOG_ERROR("[HTTP Handler]: Timeout at client %s:%u \n", (*iter)->mLayer->getHost().c_str(), (*iter)->mLayer->getPort());
(...)
}

This way i have no more timeouts.

However, not so sure if what i did was correct.

Now, about the times, i still have around 300ms for one requisition on a local server.
Re: HTTP - Initialization [message #1864117 is a reply to message #1864110] Sun, 17 March 2024 14:04 Go to previous messageGo to next message
Monika Wenger is currently offline Monika WengerFriend
Messages: 5
Registered: March 2020
Junior Member
const unsigned int CHTTP_Handler::scmSendTimeout = 20;
const unsigned int CHTTP_Handler::scmAcceptedTimeout = 5;

both of these timeouts are hard coded, maybe these should be configurable. The remaining question might be if this is sufficient to set during initialization or if a change is needed for any request. I guess the answer to this question determines if it should be an SD or within the ID.

I personally think there is nothing against your suggested code change for the timeout calculation. There is a second line with such a calculation, maybe it should be changed as well then.
Re: HTTP - Initialization [message #1864120 is a reply to message #1864117] Sun, 17 March 2024 17:42 Go to previous message
Monika Wenger is currently offline Monika WengerFriend
Messages: 5
Registered: March 2020
Junior Member
maybe using func_NOW_MONOTONIC().getInMilliSeconds() would be better in both cases
Previous Topic:No Deployment Perspective
Next Topic:READ data from file
Goto Forum:
  


Current Time: Sat Apr 27 23:31:41 GMT 2024

Powered by FUDForum. Page generated in 0.03483 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top