equal
deleted
inserted
replaced
36 unsigned __stdcall Connection(void* a) { |
36 unsigned __stdcall Connection(void* a) { |
37 Socket* s = (Socket*) a; |
37 Socket* s = (Socket*) a; |
38 |
38 |
39 g_connections.push_back(s); |
39 g_connections.push_back(s); |
40 |
40 |
41 //s->SendLine("Welcome to the Message Distributor"); |
|
42 printf("Accepted new connection (0x%x).\n"); |
41 printf("Accepted new connection (0x%x).\n"); |
43 while (1) { |
42 while (1) { |
44 std::string r = s->ReceiveLine(); |
43 std::string r = s->ReceiveLine(); |
45 if (r.empty()) break; |
44 if (r.empty()) break; |
46 //cout << r << endl; |
45 cout << r << endl; |
47 for (socket_list::iterator os =g_connections.begin(); |
46 for (socket_list::iterator os =g_connections.begin(); |
48 os!=g_connections.end(); |
47 os!=g_connections.end(); |
49 os++) { |
48 os++) { |
50 if (*os != s) (*os)->SendLine(r); |
49 if (*os != s) (*os)->SendLine(r); |
51 } |
50 } |