Hi,
I used the logic in the demo programs to build world weather functionality in my application. However, I figured out, that after a while and some queries the communication stops: no further queries are possible. The error code is 16#00FFFF00 / a DNS error. So, I separated a sample DNS test program:
PROGRAM PLC_PRG
VAR
strHost : STRING := 'www.bme.hu';
IP_C : IP_C;
S_BUF : NETWORK_BUFFER;
R_BUF : NETWORK_BUFFER;
IP_CTRL : IP_CONTROL;
DNS_CLIENT : DNS_CLIENT;
END_VAR
IP_CTRL (
IP_C := IP_C,
S_BUF := S_BUF,
R_BUF := R_BUF,
TIME_OUT := T#5s,
IP := DWORD_OF_BYTE(10,1,2,1)
);
DNS_CLIENT (
IP_C := IP_C,
S_BUF := S_BUF,
R_BUF := R_BUF,
DOMAIN := strHost
);
After starting the program and triggering variable DNS_CLIENT.ACTIVATE, the query was successful. But, the next query (reset and set ACTIVATE) failed with timeout. After some investigation with the IP?C structure, I noticed, that IP_C.C_MODE does not reset to 0 - after doing this, another DNS query was possible...
So without further and deeper investigations, I added the following quick fix to solve this:
DNS_CLIENT line 118:
99: R_BUF.SIZE := UINT#0; (* Empfangslänge rücksetzen *)
ip_state := BYTE#4; (* Abmelden *)
IP_C.C_MODE := 0;
state := 00;It seems to work fine, but I don't know, if it's correct... Ideas?