SockIt
|
00001 /* 00002 * File: TcpEvent.h 00003 * Author: jtedesco 00004 * 00005 * Created on May 27, 2011, 11:10 AM 00006 */ 00007 00008 #ifndef TCPREPLIER_H 00009 #define TCPREPLIER_H 00010 00011 #include <boost/asio.hpp> 00012 00013 #include "JSAPIAuto.h" 00014 #include "Event.h" 00015 #include "Tcp.h" 00016 00017 using boost::asio::ip::tcp; 00018 using std::string; 00019 00025 class TcpEvent: public Event 00026 { 00027 public: 00028 00036 TcpEvent(Tcp * tcp, boost::shared_ptr<tcp::socket> connection, string data); 00037 00041 virtual ~TcpEvent(); 00042 00048 virtual void send(const string & data); 00049 00055 virtual void send_bytes(const vector<byte> & bytes); 00056 00062 virtual string read() const; 00063 00069 virtual FB::VariantList read_bytes() const; 00070 00076 virtual string get_host(); 00077 00083 virtual unsigned short get_port(); 00084 00085 private: 00086 00090 string data; 00091 00095 bool failed; 00096 00100 Tcp * tcp_object; 00101 00105 string host; 00106 00110 int port; 00111 00115 boost::shared_ptr<tcp::socket> connection; 00116 }; 00117 #endif /* TCPREPLIER_H */ 00118