Happy New Year to one and All.
Guys I am having a few problems with the ::CreateThread API function.
Basically, I wish to pass the address of a structure in the fourth parameter of CreateThread. This structure contains 2 pointers to 2 different classes and a variable of SOCKET type, ie
The class pointers always contain valid pointers to data when CreateThread is called.
I also make sure to "detach" the socket member before it is passed to the CreateThread function.
However...when my structure arrives in the thread function that does the processing, one of the class pointers is NULL and the SOCKET does not contain the same number (if you run in debug mode) as it did in the calling thread. Socket communication then becomes impossible, because I am not talking on the orignal thread that was accepted.
An important thing worth mentioning, is that my structure has already been passed to one thread before it is passed to the final thread - so it is going across 2 threads. The class pointers within the structure seem to be fine when passed to the first thread, but in the second thread, one is strangely NULL'ed. I hope this all makes sense and you can help me. It's been baffling me for quite a while. Am I doing anything wrong?