33 lines
613 B
C++
33 lines
613 B
C++
/*
|
||
* main.cpp
|
||
*
|
||
* Created on: 5 сент. 2022 г.
|
||
* Author: alexander
|
||
*/
|
||
|
||
#include <ap.hpp>
|
||
#include <iostream>
|
||
|
||
#include <server.hpp>
|
||
|
||
int main(int argc, char *argv[])
|
||
{
|
||
ap::Hub hub({{ "port", 'p', ap::REQUIRED }});
|
||
hub.readArguments(argc, argv);
|
||
|
||
auto optionPort = hub.getOption('p');
|
||
if (!optionPort.isSet())
|
||
{
|
||
std::cerr << "Порт не был установлен!" << std::endl;
|
||
exit(EXIT_FAILURE);
|
||
}
|
||
|
||
int port = std::stoi(optionPort.getValues()[0]);
|
||
|
||
zh::ServerTCP tcpServer(port);
|
||
tcpServer.bind();
|
||
tcpServer.listen();
|
||
|
||
return 0;
|
||
}
|