[Boost-users] [Asio] Confusion with socket.cancel()

84 views
Skip to first unread message

Laurent Fert

unread,
Jun 22, 2009, 2:46:31 AM6/22/09
to boost...@lists.boost.org
Hi,

I am getting confused, could anyone clarify the following points?
(Note that I am in a single thread context)

1- After a call to
  socket.async_send_to(buffer, remote_endpoint, write_handler)
followed by a call to
  socket.cancel()
is it possible that the write operation completed before I called cancel() and that my write_handler will be called with no error?

2- After a call to
  socket.async_send_to(buffer, remote_endpoint, write_handler)
followed by a call to
  socket.cancel()
is it possible that some data has actually been written to the socket (let's assume the buffer is quite big) and that then, the operation has been canceled? In such case, would my write_handler be called with both boost::asio::placeholders::error set AND boost::asio::placeholders::bytes_transferred equal to the partial data that has been written?

Thanks,

Laurent

Igor R

unread,
Jun 22, 2009, 11:16:35 AM6/22/09
to boost...@lists.boost.org
I am getting confused, could anyone clarify the following points?
(Note that I am in a single thread context)

1- After a call to
  socket.async_send_to(buffer, remote_endpoint, write_handler)
followed by a call to
  socket.cancel()
 
cancel() method id not quite portable, and it's actual effect depends on the platform. Please, read the reference: http://www.boost.org/doc/libs/1_39_0/doc/html/boost_asio/reference/basic_stream_socket/cancel/overload2.html
 
Reply all
Reply to author
Forward
0 new messages