OpenDaVINCI  4.16.0
POSIXTCPConnection.h
Go to the documentation of this file.
1 
20 #ifndef OPENDAVINCI_CORE_WRAPPER_POSIXTCPCONNECTION_H_
21 #define OPENDAVINCI_CORE_WRAPPER_POSIXTCPCONNECTION_H_
22 
23 #include <memory>
24 #include <string>
25 
29 
30 namespace odcore { namespace wrapper { class Mutex; } }
31 namespace odcore { namespace wrapper { class Thread; } }
32 
33 namespace odcore {
34  namespace wrapper {
35  namespace POSIX {
36 
37  using namespace std;
38 
40  private:
47 
53  POSIXTCPConnection& operator=(const POSIXTCPConnection &);
54 
55  public:
56  POSIXTCPConnection(const int32_t &fileDescriptor);
57 
58  POSIXTCPConnection(const std::string &ip, const uint32_t &port);
59 
60  virtual ~POSIXTCPConnection();
61 
62  virtual void sendImplementation(const std::string& data);
63 
64  virtual void start();
65  virtual void stop();
66 
67  virtual bool isRunning();
68  virtual void run();
69 
70  protected:
71  void initialize();
72 
73  unique_ptr<Thread> m_thread;
74 
75  unique_ptr<Mutex> m_socketMutex;
77 
78  enum {BUFFER_SIZE = 65535};
79  char m_buffer[BUFFER_SIZE];
80  std::string m_ip;
81  uint32_t m_port;
82  };
83  }
84  }
85 }
86 #endif /* OPENDAVINCI_CORE_WRAPPER_POSIXTCPCONNECTION_H_ */
std::string m_ip
Definition: POSIXTCPConnection.h:80
unique_ptr< Thread > m_thread
Definition: POSIXTCPConnection.h:73
Definition: POSIXTCPConnection.h:39
unique_ptr< Mutex > m_socketMutex
Definition: POSIXTCPConnection.h:75
Definition: Runnable.h:35
int32_t m_fileDescriptor
Definition: POSIXTCPConnection.h:76
Definition: TCPConnection.h:40
uint32_t m_port
Definition: POSIXTCPConnection.h:81