26 #ifndef ODVA_ETHERNETIP_SOCKET_TEST_SOCKET_H 27 #define ODVA_ETHERNETIP_SOCKET_TEST_SOCKET_H 30 #include <boost/asio.hpp> 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 bool is_open
Whether the socket has been opened.
size_t tx_count
Number of characters sent via send()
string port
Port given at open.
TestSocket(const_buffer rbuf)
virtual size_t receive(mutable_buffer buf)
string hostname
Hostname given at open.
virtual void open(string hostname, string port)
size_t rx_count
Number of characters requested by client by calling receive()
virtual size_t send(const_buffer buf)
const_buffer rx_buffer
Characters to return on calls to receive()