-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
47 lines (38 loc) · 950 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <vector>
#include <string>
#include <iostream>
#include "Server.h"
#include "FileInputOutput.h"
#include "Globals.h"
int main( int argc,char* argv[] )
{
try
{
/*
if( argc < 2 )
{
std::cerr << "Usage: chat_server <port> [<port> ...]\n";
return 1;
}
*/
std::string basePath = CONFIG_FILEPATH;
std::vector<std::string> serverPorts = FIO_ReadFromFileToVector( basePath + FILE_SERVERS );
//m_serverName = configVec[0];
//m_serverPort = configVec[1];
//m_delimiter = configVec[2][0];
boost::asio::io_service ioService;
std::cout << "Start Server Stuff" << std::endl;
std::list<Server> servers;
for( int i = 0; i < argc; ++i )
{
tcp::endpoint endpoint( tcp::v4(),std::atoi( serverPorts[ i ].c_str() ) );
servers.emplace_back( ioService,endpoint );
}
ioService.run();
}
catch( std::exception& e )
{
std::cerr << "Exception: " << e.what() << "\n";
}
return 0;
}