Change structure of code base

This commit is contained in:
2025-04-30 13:06:23 +03:00
parent 3b84aa7740
commit 79fcae617e
5 changed files with 40 additions and 34 deletions

View File

@@ -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;