The demonstration code at https://www.example-code.com/cpp/socket_async.asp crashes with an access violation if the server does not support TLS. I believe this happens while (connectTask->get_Finished() != true){}
is still spinning. It should return a catchable error instead. I used https://github.com/PavelBansky/EchoTool on localhost with echotool /p tcp /s 443
as the command line argument for my server (but presumably the effect will exist with other servers.
If the server is not launched, the while loop exits cleanly. If I set useTls to false, the while loop exits cleanly.
I've pasted the call stack on crash below. I'm using Visual Studio 2013 and a basic console application.
ConsoleApplication1.exe!TlsProtocol::clientHandshake2(bool,class TlsEndpoint &,class _clsTls &,unsigned int,class SocketParams &,class LogBase &) C++
ConsoleApplication1.exe!TlsProtocol::clientHandshake(bool,class chilkat::StringBuffer const &,class TlsEndpoint &,class _clsTls &,unsigned int,class SocketParams &,class LogBase &) C++
ConsoleApplication1.exe!SChannelChilkat::connectImplicitSsl(class chilkat::StringBuffer const &,int,class _clsTls &,unsigned int,class SocketParams &,class LogBase &) C++
ConsoleApplication1.exe!Socket2::connect2(class chilkat::StringBuffer const &,int,bool,class _clsTls &,class SocketParams &,class LogBase &) C++
ConsoleApplication1.exe!Socket2::socket2Connect(class chilkat::StringBuffer const &,int,bool,class _clsTls &,unsigned int,class SocketParams &,class LogBase &) C++
ConsoleApplication1.exe!ClsSocket::clsSocketConnect(class XString &,int,bool,int,class SocketParams &,class LogBase &) C++
ConsoleApplication1.exe!ClsSocket::Connect(class XString &,int,bool,int,class ProgressEvent *) C++
ConsoleApplication1.exe!fn_socket_connect(class ClsBase *,class ClsTask *) C++
ConsoleApplication1.exe!ClsTask::callTaskFunction(class LogBase *) C++
ConsoleApplication1.exe!_ckThread::runThread(void) C++
ConsoleApplication1.exe!_ckThreadPool::finalizeThreadPool(void) C++
kernel32.dll!777f7c04() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
[External Code]