SockIt
|
00001 /* 00002 * File: UdpEvent.h 00003 * Author: jtedesco 00004 * 00005 * Created on May 27, 2011, 10:47 AM 00006 */ 00007 00008 #ifndef UDPREPLIER_H 00009 #define UDPREPLIER_H 00010 00011 #include "Event.h" 00012 #include "Udp.h" 00013 00014 using boost::asio::ip::udp; 00015 00021 class UdpEvent : public Event 00022 { 00023 public: 00024 00034 UdpEvent(Udp * udp, boost::shared_ptr<udp::socket> socket, boost::shared_ptr<udp::endpoint> endpoint, string data); 00035 00039 virtual ~UdpEvent(); 00040 00046 virtual void send(const string & data); 00047 00053 virtual void send_bytes(const vector<byte> & bytes); 00054 00060 virtual string read() const; 00061 00067 virtual FB::VariantList read_bytes() const; 00068 00074 virtual string get_host(); 00075 00081 virtual unsigned short get_port(); 00082 00083 private: 00084 00088 string data; 00089 00093 bool failed; 00094 00098 string host; 00099 00103 int port; 00104 00108 boost::shared_ptr<udp::socket> socket; 00109 00113 boost::shared_ptr<udp::endpoint> endpoint; 00114 00118 Udp * udp_object; 00119 }; 00120 00121 #endif /* UDPREPLIER_H */