Recently i started using boost::thread (also tried with STL - thread) in order to build a chat. I made at my "server-station" a class that has
- void function that get calls from main.cpp which starting the server listening + binding
- void function that is the thread that is being called from the function i stated before
Code:
this is ServerSocket.cpp file
void ServerSocket::startHosting()
{
Bind();
Listen();
boost::thread clients_listener = boost::thread(&ServerSocket::clientsListener);
}
//This is the thread function
void ServerSocket::clientsListener()
{
..... handling incoming clients sockets , code goes here ....
}
In the creating thread part i added 'this' because i read on stackoverflow that a no-static member function must have the 'this' member that represents the class, But when i added that i had another error but this time 1 value instead of 0 when the 'this' is not given
Error C2064 - term does not evaluate to a function taking 1 argument
Does someone know how to solve this and explain me the answer please? I can do a static function but that requires me to make all the other members that i need in that function as static to and i don't wanna do that