26 #ifndef ODVA_ETHERNETIP_SOCKET_TCP_SOCKET_H 27 #define ODVA_ETHERNETIP_SOCKET_TCP_SOCKET_H 30 #include <boost/asio.hpp> 37 using boost::asio::ip::tcp;
49 TCPSocket(io_service& io_serv) : socket_(io_serv) { }
56 virtual void open(
string hostname,
string port)
58 tcp::resolver resolver(socket_.get_io_service());
59 tcp::resolver::query query(hostname, port);
60 tcp::resolver::iterator endpoint_iterator = resolver.resolve(query);
61 connect(socket_, endpoint_iterator);
77 virtual size_t send(const_buffer buf)
79 return socket_.send(const_buffers_1(buf));
87 virtual size_t receive(mutable_buffer buf)
90 return socket_.receive(mutable_buffers_1(buf));
99 #endif // ODVA_ETHERNETIP_SOCKET_TCP_SOCKET_H virtual void open(string hostname, string port)
TCPSocket(io_service &io_serv)
virtual size_t send(const_buffer buf)
virtual size_t receive(mutable_buffer buf)