Boost logo

Boost Users :

From: John Urberg (john-urberg_at_[hidden])
Date: 2008-08-08 18:05:43


I'm using boost asio to send out multicast hailing messages every 15 seconds
from an ActiveX control using boost 1.35.0 and VC9. I had a proof of concept
ActiveX working fine, but in my production ActiveX, I'm able to send the first
message successfully, but every subsequent message returns a 10009 error.

Here is the code:

MulticastServer::MulticastServer(
   boost::asio::io_service& io_service,
   string addr,
   int port,
   int seconds)
: endpoint(boost::asio::ip::address::from_string(addr), port)
, socket(io_service, endpoint.protocol())
, timer(io_service)
, server_port(server_port)
, seconds(seconds)
{
   socket.set_option(boost::asio::ip::multicast::hops(32));
}
void MulticastServer::HandleTimeout(const boost::system::error_code& error)
{
   string message = BuildHailMessage();
   std::strcpy(buffer, message.c_str());
   socket.async_send_to(
      boost::asio::buffer(buffer, message.length()),
      endpoint,
      boost::bind(
         &MulticastServer::HandleSendTo,
          this,
          boost::asio::placeholders::error));
}

void MulticastServer::HandleSendTo(const boost::system::error_code& error)
{
timer.expires_from_now(boost::posix_time::seconds(seconds));
timer.async_wait(boost::bind(&MulticastServer::HandleTimeout, this,
boost::asio::placeholders::error));
}

Any ideas what would cause this error message?

Also, if I use a string instead of char[] for the buffer, I always receive a
'string iterator not dereferencable' assertion failure. How could I fix that so
I can use std::string instead of a char[] buffer?

Thanks,
John


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