Code:
...
struct connection
{
ServerSocket ...
Don't you mean
Code:
...
class connection
{
ServerSocket ...
Code:
...
connection::open();
...
This is not the proper way of doing an open() call to a connection.
Code:
connection connect(3000);
// or
connection connect();
connect->open();
// or
connect.open();
might be a better aproach, depending on, how you want to dereference your classes.
And in order to have it multithreaded, you need to use some sort of threadding.. One capturing the initial request, which spawns a child process, per clientrequest, doing all the communication with the caller and broadcasting to the clients.
So your codepart
Code:
...
while ( true )
{
std::string data;
new_sock >> data;
spawn_child_broadcast(data);
...
And among others theres alot of syntactical errors, for instance
Code:
...
for(bool iid=0;iid < 100;iid++)
You can't store a value in a bool variabel, it either is true (1, 2, 3, 4, 5 ....) or false (0), it dosn't have a storage facility where you can do calculations on it, for that theres int, double, float, etc.
And why do you do an infinite loop in your open() function, when your main function want's to do one aswell..
Code:
...
ServerSocket server(3000);
...
server.accept (socket[iid]);
...
What does your ServerSocket class look like ??
What book are you learning this from ?
I see alot of loop through alot of sockets, but basicaly, your code isn't much of a multithreaddet solution.