tcpConnection.h (509B)
1 #pragma once 2 3 #include "networkThread.h" 4 5 #include <functional> 6 #include <memory> 7 8 namespace ptypes 9 { 10 class ipstream; 11 } 12 13 namespace networkLib 14 { 15 class TcpStream; 16 17 class TcpConnection : protected NetworkThread 18 { 19 public: 20 using OnConnectedFunc = std::function<void(std::unique_ptr<TcpStream>)>; 21 22 protected: 23 explicit TcpConnection(OnConnectedFunc _onConnected); 24 virtual ~TcpConnection() = default; 25 void onConnected(ptypes::ipstream* _stream) const; 26 27 private: 28 OnConnectedFunc m_onConnected; 29 }; 30 }