| The problem I believe is because since my application is GUI | and event driven(OOP), any | action one place jumps you to another section of code, | without knowing how to get back and | say, "hey stop doing that, move on". Does this make sense?
I guess you're right, it is about multitasking. Reading from the socket places an asynchronous request somewhere. As data comes in, it gets stored in an input buffer. If the Abort routine intervenes and invalidates $data, the next read finds an invalid pointer or, worse, a pointer to an invalid buffer. If this theory is correct, then there is really no other way than to move the $data->abort() in the thread that reads from the socket, so that these two commands can never execute concurrently. If anyone knows more about the internal operations of the sockets driver, please stop me from making these wild assumptions ... :-) Have fun Harald