Hello,
I need to implement TCP client(s) in thread(s) with reconnect feature (if connection is closed with error then client tries to reconnect) which should run in service. I created server and client demo app to test this concept but I met following issues and I'm really not able to find out what's wrong in my implementation.
When I run server, start it and start internal client (client implemented the same exe) server throws "error:00000000:lib(0):func(0):reason(0), State: before SSL initialization, connection closed unexpectedly" in OnSslHandshakeDone and disconnects client. When I start (the same) client as standalone exe, it works.
When I run and start server, then run and start standalone client and then kill server app (to simulate connection error) client starts to reconnect and when server is started again TWO client connections are established (!?) from client application. The second one is correct and the first one is some ghost or whatever.
Sometimes while client tries to reconnect after text is received from server or sent to server, first connection attempt causes various exceptions and client thread is terminated.
Can you please inspect my code in attachment? Test self-signed certificate for SSL is included (SSC.pfx).
Thanks in advance
ICSTCP.ZIP