I’m having an issue with my communication through the TLS function blocks on PLCNext. As it stands, I am able to successfully send data out but have not been able to successfully activate the receive block.
Essentially, once the sending process is complete, I set send.REQ to FALSE, and receive.EN_R to TRUE (all with some time delays in between for processing order). At that point, socket.BUSY becomes TRUE and receive.ERROR becomes true with a status of #C228 (“A request to send or receive data was disallowed because the Socket has already been closed”). Oddly enough, when this happens, socket.Handle immediately tries to increment itself to a new value directly after receive.EN_R is triggered. I would guess that happens after the socket determines an error from receive and it is trying to reconnect under a new handle.
Any thoughts on why this might occur? My only other thought is some odd behavior on the end point that I’m trying to communicate with where it closes a socket connections once it’s been made once. I can provide any other details or screenshots if necessary. Thanks in advance.
Please try to set the EN_R input of the TLS_Receice function block to a constant TRUE. The receice FB must always be activated.
Please try to set the EN_R input of the TLS_Receice function block to a constant TRUE. The receice FB must always be activated.</p>
Thanks for getting back to me. If I just attach a TRUE value to the EN_R input, I get two different problems. 1) The TLS_receive FB perpetually throws a C101 error (“Unexpected error during receive operation”) and 2) The TLS_send FB throws either the C228 error (disallowed because socket is closed) or 8003 (“Not all data could be sent. Remaining data will be sent in the next cycle(s)”). I would assume both come from the receive fb trying to use the socket. I’ve also added a much longer wait time at the end of each cycle to make sure the problem isn’t that device I’m trying to communicate with is just slow at responding.
I have also tried both directly setting EN_R to TRUE forever, as well as setting it to TRUE as soon as the socket is established. In my initial attempts, I had EN_R as TRUE once the TLS_send FB had completed it’s sequence. In the last case, I wasn’t having any apparent issues with the send FB. In addition, it was the only time that the Source Ip and Source Port in the receive FB were actually updated to the target address (ie the only time I seem to have received any kind of response even though it triggers a C228 error)
Would it be more helpful to send screenshots of the state machine? Thanks again in advance

