1.配置默认使用v3。2.asio中文转u8。3.com*hpp添加一个trim功能。
This commit is contained in:
parent
f99b2cbabb
commit
2847a88525
17
server.cxx
17
server.cxx
@ -14,6 +14,15 @@ Server::~Server()
|
||||
}
|
||||
}
|
||||
|
||||
void Server::print_exception(const std::exception& e)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
std::cerr << ansi_to_u8(e.what()) << '\n';
|
||||
#else
|
||||
std::cerr << e.what() << '\n';
|
||||
#endif
|
||||
}
|
||||
|
||||
void Server::start()
|
||||
{
|
||||
asio::ip::tcp::endpoint endpoint(asio::ip::tcp::v4(), port_);
|
||||
@ -24,11 +33,7 @@ void Server::start()
|
||||
acceptor_.listen();
|
||||
do_accept();
|
||||
} catch (const std::exception& e) {
|
||||
#ifdef _WIN32
|
||||
std::cerr << ansi_to_u8(e.what()) << '\n';
|
||||
#else
|
||||
std::cerr << e.what() << '\n';
|
||||
#endif
|
||||
print_exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,4 +164,4 @@ bool Server::send_frame(const std::shared_ptr<asio::ip::tcp::socket>& socket, Fr
|
||||
|
||||
delete[] send_data;
|
||||
return send_len == len;
|
||||
}
|
||||
}
|
1
server.h
1
server.h
@ -34,6 +34,7 @@ private:
|
||||
|
||||
std::string post_data(const std::string& data);
|
||||
bool send_frame(const std::shared_ptr<asio::ip::tcp::socket>& socket, FrameData& data);
|
||||
void print_exception(const std::exception& e);
|
||||
|
||||
private:
|
||||
asio::io_context& io_context_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user