UniSet  2.7.0
UTCPSocket.h
1 // -------------------------------------------------------------------------
2 #ifndef UTCPSocket_H_
3 #define UTCPSocket_H_
4 // -------------------------------------------------------------------------
5 #include <string>
6 #include <Poco/Net/ServerSocket.h>
7 #include "PassiveTimer.h" // for timeout_t
8 // -------------------------------------------------------------------------
9 namespace uniset
10 {
11 
12  class UTCPSocket:
13  public Poco::Net::ServerSocket
14  {
15  public:
16 
17  UTCPSocket();
18 
19  // dup and accept...raw socket
20  UTCPSocket( int sock );
21 
22  UTCPSocket( const std::string& host, int port );
23 
24  virtual ~UTCPSocket();
25 
26  // set keepalive params
27  // return true if OK
28  bool setKeepAliveParams( timeout_t timeout_sec = 5, int conn_keepcnt = 1, int keepintvl = 2 );
29 
30  int getSocket() const noexcept;
31 
32  protected:
33  void init();
34 
35  private:
36 
37  };
38  // -------------------------------------------------------------------------
39 } // end of uniset namespace
40 // -------------------------------------------------------------------------
41 #endif // UTCPSocket_H_
42 // -------------------------------------------------------------------------
Definition: CallbackTimer.h:29
Definition: UTCPSocket.h:12