Re: [asio-users] Best way to store a message to be broadcast
Brought to you by:
chris_kohlhoff
From: Green, C. <cli...@bo...> - 2012-02-21 06:31:40
|
Take a look at the "shared_const_buffer" class in the Asio example / documentation. It's a fairly simple buf class that wraps a shared pointer and provides appropriate typedefs for the Asio buffer classes. It will allow you to create one buffer that is used in multiple async writes, and when the last one finishes, the buffer will be destroyed "automagically" (the ref count of the shared pointer goes to 0). It's relatively efficient and doesn't require any extra bookkeeping. Cliff -----Original Message----- From: Darren Cook [mailto:da...@dc...] Sent: Monday, February 20, 2012 6:47 PM To: asi...@li... Subject: [asio-users] Best way to store a message to be broadcast I asked this question on stackoverflow: http://stackoverflow.com/q/9324695/841830 Short version: what is the best way to (compose and) store a message to be broadcast with async_write()? I have something working, but there seems to be a lot of copying going on. I can see lots of choices in asio, but I'm hoping for guidance on which is best in this case (and why). Thanks! Darren P.S. If you hate StackOverflow, I don't mind answering here too. -- Darren Cook, Software Researcher/Developer http://dcook.org/work/ (About me and my work) http://dcook.org/blogs.html (My blogs and articles) ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ asio-users mailing list asi...@li... https://lists.sourceforge.net/lists/listinfo/asio-users _______________________________________________ Using Asio? List your project at http://think-async.com/Asio/WhoIsUsingAsio |