26 #ifndef ODVA_ETHERNETIP_SOCKET_TEST_SOCKET_H
27 #define ODVA_ETHERNETIP_SOCKET_TEST_SOCKET_H
30 #include <boost/asio.hpp>
36 using namespace boost::asio;
58 unsigned char tx_buffer[4096];
67 TestSocket() : tx_count(0), rx_count(0), is_open(false) { }
69 TestSocket(const_buffer rbuf) : tx_count(0), rx_count(0), rx_buffer(rbuf), is_open(false) { }
76 virtual void open(
string hostname,
string port)
78 this->hostname = hostname;
96 virtual size_t send(const_buffer buf)
98 size_t n = buffer_copy(buffer(tx_buffer) + tx_count, buf);
110 size_t n = buffer_copy(buf, rx_buffer);
112 rx_buffer = rx_buffer + n;
122 memset(tx_buffer, 0,
sizeof(tx_count));
129 #endif // ODVA_ETHERNETIP_SOCKET_TEST_SOCKET_H