gusucode.com > 它是一个c_s网络编程框架源码程序 > st_asio_wrapper/file_server/file_server.cpp
//configuration #define SERVER_PORT 5050 #define AUTO_CLEAR_CLOSED_SOCKET //auto clear closed clients #define ENHANCED_STABILITY //configuration #include "file_server.h" #define QUIT_COMMAND "quit" #define LIST_ALL_CLIENT "list_all_client" int main() { std::string str; file_server file_server_; puts("\nthis is a file server."); puts("type quit to end this server."); file_server_.start_service(); while(file_server_.is_running()) { std::getline(std::cin, str); if (str == QUIT_COMMAND) file_server_.stop_service(); else if (str == LIST_ALL_CLIENT) file_server_.list_all_client(); else file_server_.talk(str); } return 0; } //restore configuration #undef SERVER_PORT #undef AUTO_CLEAR_CLOSED_SOCKET //auto clear closed clients #undef ENHANCED_STABILITY //restore configuration