I'm working on a multiclient chat project.
Here is my code:
struct RecvDataModel
{
int sockAddr;
char *inData;
};
void *ProcessData(void *arg);
void Client::Recv(int sockAddr, char *inData)
{
RecvDataModel outData;
outData.sockAddr = sockAddr;
outData.inData = inData;
pthread_t rThr;
pthread_create(&rThr, NULL, ProcessData, (void*)&outData);
}
void *ProcessData(void *arg)
{
RecvDataModel *inData = (RecvDataModel*)arg;
cout << inData->inData << endl;
return 0;
}
Basically if sockAddr (in Client::Recv) equals "55" ProcessData's cout function writing "31784736", if equals "0" cout's "5120"
That's my big problem! I can't continue without this! (I'm using eclipse C++) What's the problem? I have already looked some example projects like this: Link >>>