otsdaq  3.04.02
Socket.h
1 #ifndef _ots_Socket_h_
2 #define _ots_Socket_h_
3 
4 #include <netinet/in.h>
5 #include <sys/types.h>
6 #include <string>
7 
8 namespace ots
9 {
10 class Socket
11 {
12  public:
13  Socket(const std::string& IPAddress, unsigned int port = 0);
14  virtual ~Socket(void);
15 
16  virtual void initialize(
17  unsigned int socketReceiveBufferSize = defaultSocketReceiveSize_);
18  const struct sockaddr_in& getSocketAddress(void);
19  const std::string& getIPAddress() { return IPAddress_; }
20  uint16_t getPort();
21  bool isInitialized() { return isInitialized_; }
22 
23  protected:
24  enum
25  {
26  maxSocketSize_ = 65536,
27  defaultSocketReceiveSize_ = 0x10000
28  };
29 
30  Socket(void);
31  struct sockaddr_in socketAddress_;
32  int socketNumber_;
33  // unsigned int maxSocketSize_;
34 
35  protected:
36  enum
37  {
38  FirstSocketPort = 10000,
39  LastSocketPort = 15000
40  };
41  std::string IPAddress_;
42  unsigned int requestedPort_;
43  bool isInitialized_ = false;
44 };
45 
46 } // namespace ots
47 
48 #endif
Socket(void)
protected constructor
Definition: Socket.cc:62
defines used also by OtsConfigurationWizardSupervisor