otsdaq  v1_01_03
 All Classes Namespaces Functions
Socket.h
1 #ifndef _ots_Socket_h_
2 #define _ots_Socket_h_
3 
4 #include <sys/types.h>
5 #include <netinet/in.h>
6 #include <string>
7 
8 namespace ots
9 {
10 
11 class Socket
12 {
13 public:
14  Socket(const std::string &IPAddress, unsigned int port=0);
15  virtual ~Socket(void);
16 
17  virtual void initialize(void);
18  const struct sockaddr_in& getSocketAddress(void);
19  const std::string& getIPAddress() { return IPAddress_; }
20  const unsigned int& getPort() { return port_; }
21 
22 protected:
23  enum{maxSocketSize_ = 65536};
24 
25  Socket(void);
26  struct sockaddr_in socketAddress_;
27  int socketNumber_;
28  //unsigned int maxSocketSize_;
29 
30 private:
31  enum{FirstSocketPort=10000,LastSocketPort=15000};
32  std::string IPAddress_;
33  unsigned int port_;
34 };
35 
36 }
37 
38 #endif