UniSet  2.7.0
UDPCore.h
1 // -------------------------------------------------------------------------
2 #ifndef UDPReceiveU_H_
3 #define UDPReceiveU_H_
4 // -------------------------------------------------------------------------
5 #include <Poco/Net/DatagramSocket.h>
6 // -------------------------------------------------------------------------
7 // Классы-обёртки, чтобы достучаться до "сырого сокета" и других функций
8 // необходимых при использовании с libev..
9 // -------------------------------------------------------------------------
10 namespace uniset
11 {
12 
13  class UDPSocketU:
14  public Poco::Net::DatagramSocket
15  {
16  public:
17 
18  UDPSocketU():
19  Poco::Net::DatagramSocket(Poco::Net::IPAddress::IPv4)
20  {}
21 
22  UDPSocketU( const std::string& bind, int port ):
23  Poco::Net::DatagramSocket(Poco::Net::SocketAddress(bind, port), true)
24  {}
25 
26  virtual ~UDPSocketU() {}
27 
28  inline int getSocket() const
29  {
30  return Poco::Net::DatagramSocket::sockfd();
31  }
32  };
33  // -------------------------------------------------------------------------
34  class UDPReceiveU:
35  public Poco::Net::DatagramSocket
36  {
37  public:
38 
39  UDPReceiveU():
40  Poco::Net::DatagramSocket(Poco::Net::IPAddress::IPv4)
41  {}
42 
43  UDPReceiveU( const std::string& bind, int port):
44  Poco::Net::DatagramSocket(Poco::Net::SocketAddress(bind, port), true)
45  {}
46 
47  virtual ~UDPReceiveU() {}
48 
49  inline int getSocket()
50  {
51  return Poco::Net::DatagramSocket::sockfd();
52  }
53  };
54  // -------------------------------------------------------------------------
55 } // end of uniset namespace
56 // -------------------------------------------------------------------------
57 #endif // UDPReceiveU_H_
58 // -------------------------------------------------------------------------
Definition: CallbackTimer.h:29
Definition: UDPCore.h:13
Definition: UDPCore.h:34