Hi,
We are using the AsHttp library for REST communication between our X20CP0410 and a robot.
The communication is working most of the time, but we have an issue where we are sometimes missing frames, and we are not sure why.
Our program is written in C++, where I have a client object:
httpClient_typ _client;
So whenever I issue a request I cycle the client object:
httpClient(&_client);
I monitor all of the different statuses of the function block so I can detect when the request is complete:
bool http_done = (_client.httpStatus != 0);
bool query_error = (_client.status != ERR_OK && _client.status != ERR_FUB_BUSY);
bool tcp_error = (_client.tcpStatus!= ERR_OK && _client.tcpStatus!= ERR_FUB_BUSY);
Further, I am running a timer to give me a timeout if none of the above happens within a few seconds of the request being issued:
bool timeout_error = _connection_timeout.Q;
Where _connection_timeout
is a TON_typ
object set up elsewhere, and cycled as TON(&_connection_timeout);
I can check when the query is done:
if (http_done || query_error || tcp_error || timeout_error) { ... }
Our issue is that we sometimes get the timeout_error
, as if the PLC doesn’t complete the query within 1.5s.
However, we are logging the actual network traffic using wireshark on a Windows PC, and we can see that both the initial frame from the PLC as well as the response from the robot is transmitted as intended, so it seems that the PLC receives the response to its query, but it is not passed to our code.
The issue is not persistent, in that everything works most of the time, but then sometimes we get this timeout error where frames are dropped.
I really need some help figuring out what is going on, or if there is some status/indicator I am not monitoring correctly in my code.