Hello,
I realize a client-serv UDP in c++ with VS8. The data sand size can be very different: 10o to 1Mo.
My program has two threads who do the communication. The reception thread has a problem during the data reconstruction. The program refuse to allocate memory: it bug: wrong access memory.
Like i said before, data size are not fixed so i need dynamic memory. For this i tried to use vector<char> and char* but together do a memory bug.
Do you know if it s possible to use dynamic memory in a thread or if this is restrict? or others ideas?
Sorry i just wanted say i have try to save my data with vector<char> but it doesn t fonction so i tried after with char* in a second version. I didn t need to do conversion.
And when i do a puchback for example for the vector or a memcopy for the char* for the second version i have a memory bug. For the vector it cann t alocate a new char place
It s very strange because if i run my program in main fonction it fonction but in a thread memory bug :(
I created my var in the thread stack and i didn t know threads can t share this stack.
So solution pass all var in pointer like all is in the ram. And no pb of writting.