AuthenticateAsClient() freezes/hangs application

Hello, I am testing a secure SSL Stream using a TCP connection with a local server. However, the server is simply a middle man between two clients and does not do anything (or respond with anything when connected). This server is also not secure, so I would expect the TLS 1.2 authentication to fail and throw an exception as I’ve seen in the past.

Unfortunately, when I call the AuthenticateAsClient() method, the entire program freezes/hangs, pausing all threads everywhere, ultimately causing the watchdog to hit and the application to restart. I suspect it is just waiting for a valid response from the server, but it does not receive anything so it just keeps waiting…

I’ve tried changing both the client socket and SSL stream read/write timeouts with no success. I think this is a larger .NET issue with similar posts online, but I wasn’t able to implement some of their solutions because of the more limited scope of TinyCLR. Does anyone have any suggestions?

Do all systems that need to communicate with each other have the same timezone and synchronized times? Try to synchronize them all with the same sntp server before establishing communication otherwise this could be the problem.

I added the NTP sync and that unfortunately did not help.

I did notice, however, that when I unplug the ethernet cable after it freezes, the cable disconnect interrupt triggers and the program is able to resume normally. The AuthenticateAsClient() method throws its exception as expected.

Does this imply it might be something on the ethernet side of things? Is this a common issue?

Also tried implementing TLS entropy as shown in this post with no success.

send us simple project and what firmware are you using, please?

1 Like

Hello again! I made a sample project on visual studio and put it in a google drive folder in the following link:

I didn’t include my certificates because…well obviously… but, it should work otherwise and gets the point across. Please note that I have verified the authenticate method works correctly when the server is also using TLS. My issue is when it tries a secure connection to a server that is not secure and which does not send any data. The application freezes and it won’t throw an exception or move on after a set time. However, if the server does send data the authentication will fail and move on es expected. Please let me know if that doesn’t make sense or if you have any questions, thanks!

Oh, also using firmware version

Thank you

we added to AuthenticateAsClient() freezes/hangs application · Issue #1242 · ghi-electronics/TinyCLR-Libraries (
and will look into it soon

1 Like