Change structure of code base
This commit is contained in:
@@ -3,9 +3,10 @@
|
||||
int main(int argc, char **argv) {
|
||||
int opt;
|
||||
std::string host = "localhost";
|
||||
bool service_mode = false;
|
||||
short unsigned port = 1024u;
|
||||
|
||||
while ((opt = getopt(argc, argv, "h:p:")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "h:p:s:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'h':
|
||||
host = optarg;
|
||||
@@ -13,14 +14,16 @@ int main(int argc, char **argv) {
|
||||
case 'p':
|
||||
port = static_cast<unsigned short>(atoi(optarg));
|
||||
break;
|
||||
case 's':
|
||||
service_mode = true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Server server;
|
||||
server.start(host, port);
|
||||
Server server(host, port, service_mode);
|
||||
server.start();
|
||||
} catch (const std::runtime_error& e){
|
||||
std::cerr << "Client application error: " << e.what() << std::endl;
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user