communication with threads
-
i'm trickering a thread from another thread, from the old thread i give the SOCKET towards the new thread as a parameter. in the new thread i make a connection with a class for the functions of the thread, now i'm able to send data from my thread to my class, but i have no idear how to send a command from my class toward an other thread(to send data to de client SOCKET). so, how can i send data from the Class towards my Thread(to send the data to another computer)??
Server Thread ==> Client Thread(receive data) ==> Class CConnection Class CConnection ==> Client Thread(send data) Server Thread: UINT ServerThread(LPVOID Param((LPVOID)this)) Client Thread: UINT ClientThreadRecv(LPVOID Client(socket)) Client Thread: UINT ClientThreadSend(LPVOID Client(socket))
-
i'm trickering a thread from another thread, from the old thread i give the SOCKET towards the new thread as a parameter. in the new thread i make a connection with a class for the functions of the thread, now i'm able to send data from my thread to my class, but i have no idear how to send a command from my class toward an other thread(to send data to de client SOCKET). so, how can i send data from the Class towards my Thread(to send the data to another computer)??
Server Thread ==> Client Thread(receive data) ==> Class CConnection Class CConnection ==> Client Thread(send data) Server Thread: UINT ServerThread(LPVOID Param((LPVOID)this)) Client Thread: UINT ClientThreadRecv(LPVOID Client(socket)) Client Thread: UINT ClientThreadSend(LPVOID Client(socket))
Use PostThreadMessage in your class to post a message to your thread and GetMessage in your thread to get message posted by class. A. Riazi