UniSet 2.32.1
UDPCore.h
1// -------------------------------------------------------------------------
2#ifndef UDPCore_H_
3#define UDPCore_H_
4// -------------------------------------------------------------------------
5#include <Poco/Net/DatagramSocket.h>
6#include <Poco/Net/MulticastSocket.h>
7// -------------------------------------------------------------------------
8// Классы-обёртки, чтобы достучаться до "сырого сокета" и других функций
9// необходимых при использовании с libev..
10// -------------------------------------------------------------------------
11namespace uniset
12{
13
15 public Poco::Net::DatagramSocket
16 {
17 public:
18
19 UDPSocketU():
20 Poco::Net::DatagramSocket(Poco::Net::IPAddress::IPv4)
21 {}
22
23 UDPSocketU( const std::string& bind, int port ):
24 Poco::Net::DatagramSocket(Poco::Net::SocketAddress(bind, port), true)
25 {}
26
27 virtual ~UDPSocketU() {}
28
29 inline int getSocket() const
30 {
31 return Poco::Net::DatagramSocket::sockfd();
32 }
33 };
34 // -------------------------------------------------------------------------
36 public Poco::Net::DatagramSocket
37 {
38 public:
39
41 Poco::Net::DatagramSocket(Poco::Net::IPAddress::IPv4)
42 {}
43
44 UDPReceiveU( const std::string& bind, int port):
45 Poco::Net::DatagramSocket(Poco::Net::SocketAddress(bind, port), true)
46 {}
47
48 virtual ~UDPReceiveU() {}
49
50 inline int getSocket()
51 {
52 return Poco::Net::DatagramSocket::sockfd();
53 }
54 };
55 // -------------------------------------------------------------------------
57 public Poco::Net::MulticastSocket
58 {
59 public:
60
62 Poco::Net::MulticastSocket(Poco::Net::IPAddress::IPv4)
63 {}
64
65 MulticastSocketU( int port ):
66 Poco::Net::MulticastSocket(Poco::Net::SocketAddress(Poco::Net::IPAddress(), port), true)
67 {}
68
69 MulticastSocketU( const std::string& bind, int port ):
70 Poco::Net::MulticastSocket(Poco::Net::SocketAddress(bind, port), true)
71 {}
72
73 MulticastSocketU( const Poco::Net::SocketAddress& addr ):
74 Poco::Net::MulticastSocket(addr, true)
75 {}
76
77 virtual ~MulticastSocketU() {}
78
79 inline int getSocket() const
80 {
81 return Poco::Net::MulticastSocket::sockfd();
82 }
83 };
84 // -------------------------------------------------------------------------
85} // end of uniset namespace
86// -------------------------------------------------------------------------
87#endif // UDPCore_H_
88// -------------------------------------------------------------------------
Definition UDPCore.h:58
Definition UDPCore.h:37
Definition UDPCore.h:16
Definition Calibration.h:27