• Advertisement

Archived

This topic is now archived and is closed to further replies.

winsock threading

This topic is 5124 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, sorry if this should be in network programming but i''m only begginning at winsock and threading so, i dunno anyway, heres my problem. i''m trying to write a Server class which has an acceptClient() function and a createThread() fucntion to create the thread for acceptClient. heres my code, void Server::createThread() { // create mutex here // this works ok // now create thread int threadID; ->threadHandle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)acceptClient, NULL, 0, (LPDWORD)&threadID); } the error i''m getting is: typecast: cannot convert from '''' to ''unsigned long(__stdcall*) (void*) none of the functions with this name in scope match the target type ------------------------------------ i''m stumped, i got this code from a tutorial on gametutorials.com and i am trying to make it more OO (because thats a major factor in my college and this is for a final year project) any help is really apreciated, thanks

Share this post


Link to post
Share on other sites
Advertisement
I''m going to guess that the acceptClient() function is a class member function. Member functions don''t play nicely with Win32 function pointers. The easiest way to handle this is to change the function you are trying to spawn a thread to into a static member function. If you need access to an actual class instance, you can cast it to a void * and pass it in the lpParameter parameter in the CreateThread() function.

Share this post


Link to post
Share on other sites

  • Advertisement