CAsyncSocket crashes my application if I delete the CAsyncSocket after a call to Connect, but before the OnConnect callback has been called. ASSERT(pSocket != NULL) fails in CAsyncSocket::DoCallBack and the application exits.
In other words, if I create a CAsyncSocket, try to connect it to a server, and then kill it before that connection either succeeds or fails, I have problems. I can avoid this particular crash by implementing OnConnect and setting a flag which indicates that the connection attempt completed. If the flag is false I know it's not safe to delete.
Are there other cases I need to check for before I delete the object? Is there a single way to check if it's safe? Or do I need to implement all of the callbacks for any operation I might initiate (OnReceive, OnSend, OnConnect ) and ensure those callbacks have been called?
Please refer to the FIX: Assertion Failed, Line 475 of Sockcore.cpp, Microsoft Support article to perform the analysis.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With