|
Boost Users : |
From: James Vanns (james.vanns_at_[hidden])
Date: 2008-07-09 06:56:29
I am using this as my main event loop (so I can call it within another event loop that does additional processing):
wait () {
m_io.run_one(); // Executes at most 1
m_io.reset(); // Apparently I must do this
m_io.poll(); // Executes 0 or more handlers but doesn't block
m_io.reset(); // Apparently I must do this
}
So that run_one blocks until at least 1 handler has been executed and then poll doesn't block but executes the rest...
I register a callback with async_read and async_write. On the client side the write callback is executed and the buffer is emptied (I'm using asio::streambuf). However, on the receiving endpoint (the server) the io_service reports that handlers (the correct amount for a send/write from the client side - e.g. they tally) are ready or have been executed - but no callback is actually registered. Running wireshark (ethereal) whilst the send/recvs are supposed to be happening reports that no data is sent!! That is, until I quite the client app (which closes the socket, stops the io_service etc.) then wireshark reports all the data that should have already been sent! I am really confused!! The callbacks report that the data has been sent (or at least that is what I understand) and the callbacks are even executed at the other end (or rather they're not but the io_service reports that handlers have been executed!).
Can anyone think of why this might be??
Regards,
Jim
PS: Some more code:
async_write (m_socket, m_outbound,
transfer_at_least(p_max),
bind(&base_io::write_callback,
shared_from_this(),
placeholders::error,
placeholders::bytes_transferred));
async_read (m_socket, m_inbound,
bind(&base_io::read_callback,
shared_from_this(),
placeholders::error,
placeholders::bytes_transferred));
-- James Vanns Systems Programmer Framestore CFC Ltd.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net