Hi Guys,
I am trying to get my head around multi-thread (solely for learning purposes at this stage).
I have created a basic networking class which is connecting fine at the moment able to connect to multiple clients etc. No problems.
I want to be able to connect to multiple clients at the same time using multi-threading (again, for learning purposes).
I have two classes Network and Connection.
'Network' has a vector of 'Connection'. So each client we want to (attempt) to connect to gets pushed on to that vector.
Network.ConnectAll() then iterates through each 'Connection' in the list to try to connect to it.
I am trying to work out a way to multi-thread this part of it so each connection attempt happens in its own thread.
So far I have the following;
int ConnectAllThreaded()
{
for (std::vector<Connection>::iterator it = connectionVector.begin(); it != connectionVector.end(); ++it)
{
std::thread t1(&it->Connect);
t1.join();
}
return 0;
}
'&': illegal operation on bound member function expression