26 #ifndef ODVA_ETHERNETIP_SOCKET_SOCKET_H 27 #define ODVA_ETHERNETIP_SOCKET_SOCKET_H 30 #include <boost/asio.hpp> 37 using boost::asio::buffer;
38 using boost::asio::const_buffer;
39 using boost::asio::mutable_buffer;
43 using serialization::Serializable;
44 using serialization::BufferWriter;
63 virtual void open(
string hostname,
string port) = 0;
68 virtual void close() = 0;
75 virtual size_t send(const_buffer buf) = 0;
82 virtual size_t send(
const Serializable& msg)
84 std::vector<char> buf(msg.getLength());
85 BufferWriter writer(buffer(buf));
86 msg.serialize(writer);
87 return send(buffer(buf));
95 virtual size_t receive(mutable_buffer buf) = 0;
101 #endif // ODVA_ETHERNETIP_SOCKET_SOCKET_H
virtual size_t receive(mutable_buffer buf)=0
virtual size_t send(const Serializable &msg)
virtual size_t send(const_buffer buf)=0
virtual void open(string hostname, string port)=0