You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

tcpserver.h 418 B

8 years ago
1234567891011121314151617181920212223
  1. #ifndef TCPSERVER_H
  2. #define TCPSERVER_H
  3. #include <functional>
  4. class TcpServer
  5. {
  6. public:
  7. TcpServer();
  8. typedef std::function<void (int socket)> ClientHandler;
  9. public:
  10. bool start(int port);
  11. void whenNewClient(ClientHandler onClientConnected);
  12. void stop();
  13. private:
  14. void keepAccept();
  15. private:
  16. ClientHandler mClientHandler;
  17. bool mStarted=false;
  18. int mSocket;
  19. };
  20. #endif // TCPSERVER_H

mac下的“飞秋”大多数只是飞鸽传书协议,而且未发现令人满意的开源项目,所以基于c++与qt实现了基础的飞秋协议。

Contributors (1)