<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel rdf:about="http://blog.gmane.org/gmane.comp.lib.boost.asio.user">
    <title>gmane.comp.lib.boost.asio.user</title>
    <link>http://blog.gmane.org/gmane.comp.lib.boost.asio.user</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5259"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5251"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5239"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5233"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5228"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5218"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5217"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5215"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5214"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5210"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5207"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5201"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5198"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5188"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5187"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5179"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5177"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5172"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5155"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5142"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5259">
    <title>Socket MT safety</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5259</link>
    <description>&lt;pre&gt;From: Igor R &amp;lt;boost.lists&amp;lt; at &amp;gt;gm...&amp;gt; - 2012-05-23 17:10

That was kind of misunderstanding. As far as I remember, I meant that


OK, I see.

So, may I just protect all calls to the socket methods with mutex, without
using strands to serialize the calls of completition handlers? I really
want my read and write handlers to work concurrently in different threads.

There is a statement in asio manual which make me unsure:


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
asio-users mailing list
asio-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio
&lt;/pre&gt;</description>
    <dc:creator>Nikki Chumakov</dc:creator>
    <dc:date>2012-05-23T17:32:09</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5251">
    <title>Socket MT safety</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5251</link>
    <description>&lt;pre&gt;Hi,

Would like to ask just for clarification.

Assuming my code (including competition handlers) is MT-safe

- can I call basic_socket's async_read and async_write methods from
two different threads for the same socket instance without
synchronization?

- can I call "async_read" (or "async_write") and "cancel" methods from
different threads?

- can I call "async_read" (or "async_write") and "close" methods from
different threads?

- can I call "close" and "cancel" methods from different threads?

Regards,
Nikki

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
asio-users mailing list
asio-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio

&lt;/pre&gt;</description>
    <dc:creator>Nikki Chumakov</dc:creator>
    <dc:date>2012-05-23T13:51:57</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5239">
    <title>Segmentation fault (core dumped)</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5239</link>
    <description>&lt;pre&gt;I keep getting this error every so often when my application exits. Is this a boost::asio bug? To me it looks like it since the crash happens within boost::asio (segmentation fault), but I could be doing something wrong.


---------------------------------

Program terminated with signal 11, Segmentation fault.
#0  0x00007f50d717165a in boost::asio::detail::task_io_service::wake_one_idle_thread_and_unlock (this=0x20bad90, lock=...) at /usr/include/boost/asio/detail/impl/task_io_service.ipp:461
461        first_idle_thread_ = idle_thread-&amp;gt;next;
(gdb) bt
#0  0x00007f50d717165a in boost::asio::detail::task_io_service::wake_one_idle_thread_and_unlock (this=0x20bad90, lock=...) at /usr/include/boost/asio/detail/impl/task_io_service.ipp:461
#1  0x00007f50d71716e0 in boost::asio::detail::task_io_service::wake_one_thread_and_unlock (this=0x20bad90, lock=...) at /usr/include/boost/asio/detail/impl/task_io_service.ipp:472
#2  0x00007f50d71715d5 in boost::asio::detail::task_io_service::post_deferred_completion (this=0x20bad90, op=0x20ba230) at /usr/include/boost/asio/detail/impl/task_io_service.ipp:286
#3  0x00007f50d7171512 in boost::asio::detail::task_io_service::post_immediate_completion (this=0x20bad90, op=0x20ba230) at /usr/include/boost/asio/detail/impl/task_io_service.ipp:265
#4  0x00007f50d71bb691 in boost::asio::detail::strand_service::do_dispatch (this=0x20b8ce0, impl=&amp;lt; at &amp;gt;0x7f50c002d718: 0x20ba230, op=0x7f50c0eec470) at /usr/include/boost/asio/detail/impl/strand_service.ipp:115
#5  0x00007f50d72ceafc in boost::asio::detail::strand_service::dispatch&amp;lt;boost::asio::detail::binder2&amp;lt;std::_Bind&amp;lt;std::_Mem_fn&amp;lt;void (libbitcoin::poller::*)(std::error_code const&amp;amp;, libbitcoin::message::inventory const&amp;amp;, std::shared_ptr&amp;lt;libbitcoin::channel&amp;gt;)&amp;gt; (std::shared_ptr&amp;lt;libbitcoin::poller&amp;gt;, std::_Placeholder&amp;lt;1&amp;gt;, std::_Placeholder&amp;lt;2&amp;gt;, std::shared_ptr&amp;lt;libbitcoin::channel&amp;gt;)&amp;gt;, std::error_code, libbitcoin::message::inventory&amp;gt; &amp;gt;(boost::asio::detail::strand_service::strand_impl*&amp;amp;, boost::asio::detail::binder2&amp;lt;std::_Bind&amp;lt;std::_Mem_fn&amp;lt;void (libbitcoin::poller::*)(std::error_code const&amp;amp;, libbitcoin::message::inventory const&amp;amp;, std::shared_ptr&amp;lt;libbitcoin::channel&amp;gt;)&amp;gt; (std::shared_ptr&amp;lt;libbitcoin::poller&amp;gt;, std::_Placeholder&amp;lt;1&amp;gt;, std::_Placeholder&amp;lt;2&amp;gt;, std::shared_ptr&amp;lt;libbitcoin::channel&amp;gt;)&amp;gt;, std::error_code, libbitcoin::message::inventory&amp;gt;) (
    this=0x20b8ce0, impl=&amp;lt; at &amp;gt;0x7f50c002d718: 0x20ba230, handler=...) at /usr/include/boost/asio/detail/impl/strand_service.hpp:79
#6  0x00007f50d72ccae7 in boost::asio::io_service::strand::dispatch&amp;lt;boost::asio::detail::binder2&amp;lt;std::_Bind&amp;lt;std::_Mem_fn&amp;lt;void (libbitcoin::poller::*)(std::error_code const&amp;amp;, libbitcoin::message::inventory const&amp;amp;, std::shared_ptr&amp;lt;libbitcoin::channel&amp;gt;)&amp;gt; (std::shared_ptr&amp;lt;libbitcoin::poller&amp;gt;, std::_Placeholder&amp;lt;1&amp;gt;, std::_Placeholder&amp;lt;2&amp;gt;, std::shared_ptr&amp;lt;libbitcoin::channel&amp;gt;)&amp;gt;, std::error_code, libbitcoin::message::inventory&amp;gt; &amp;gt;(boost::asio::detail::binder2&amp;lt;std::_Bind&amp;lt;std::_Mem_fn&amp;lt;void (libbitcoin::poller::*)(std::error_code const&amp;amp;, libbitcoin::message::inventory const&amp;amp;, std::shared_ptr&amp;lt;libbitcoin::channel&amp;gt;)&amp;gt; (std::shared_ptr&amp;lt;libbitcoin::poller&amp;gt;, std::_Placeholder&amp;lt;1&amp;gt;, std::_Placeholder&amp;lt;2&amp;gt;, std::shared_ptr&amp;lt;libbitcoin::channel&amp;gt;)&amp;gt;, std::error_code, libbitcoin::message::inventory&amp;gt;&amp;amp;&amp;amp;) (this=0x7f50c002d710, handler=...)
    at /usr/include/boost/asio/strand.hpp:150

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
asio-users mailing list
asio-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio

&lt;/pre&gt;</description>
    <dc:creator>Amir Taaki</dc:creator>
    <dc:date>2012-05-18T13:17:19</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5233">
    <title>Boost/Asio "short read" error</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5233</link>
    <description>&lt;pre&gt;Hi,
I have problem with asio - sometimes server returns "short read" error.
I'm using client/server from the examples, I have boost 1.49, Windows 7 64 bit (application is 64 bit).
Please write me - is it just a bug or wrong implemented example inside of boost because the error occurs not every time.
How to protect my application against the error?
I tried to ask in boost mailing list but without result.
It is extremely important to me to determine what cause the error.
Best regards,
Marcin Głogowski

Dom Maklerski Banku Ochrony Środowiska Spółka Akcyjna
ul. Marszałkowska 78/80 / 00-517 Warszawa

wpisana w Rejestrze Przedsiębiorców prowadzonym przez
Sąd Rejonowy dla m. st. Warszawy XII Wydział Gospodarczy Krajowego Rejestru Sądowego
pod numerem: KRS 0000048901 / NIP 526-10-26-828

Kapitał zakładowy w wysokości 21.551.200zł wpłacony w całości.

P - Nie drukuj tej wiadomości, jeśli to nie jest konieczne.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
asio-users mailing list
asio-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio
&lt;/pre&gt;</description>
    <dc:creator>Marcin Głogowski</dc:creator>
    <dc:date>2012-05-16T09:55:46</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5228">
    <title>thread::interrupt and asio::ios_service::run</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5228</link>
    <description>&lt;pre&gt;Hello all,

Sorry if it is very basic, jsut could not find an answer. Does
io_service::run supports boost::thread::interrupt?

I wrote small example which i expected to work, but it does not
(prints "interrupting" and exits, second thread does not exit at all):

#include &amp;lt;boost/thread.hpp&amp;gt;
#include &amp;lt;boost/asio.hpp&amp;gt;
#include &amp;lt;iostream&amp;gt;

void hello_timer (boost::system::error_code const &amp;amp;ec) { std::cerr &amp;lt;&amp;lt;
"timer\n"; }

void ios_run (boost::asio::io_service *ios)
{
   try
   {
      ios-&amp;gt;run ();
      std::cerr &amp;lt;&amp;lt; "thread quit\n";
   }
   catch (std::exception const &amp;amp;e)
   {
      std::cerr &amp;lt;&amp;lt; "exception: " + std::string (e.what ()) + "\n";
   }
}

int main ()
{
   boost::asio::io_service ios;
   boost::asio::deadline_timer dt (ios);
   dt.expires_from_now (boost::posix_time::minutes (15));
   dt.async_wait (hello_timer);
   boost::thread t (boost::bind (ios_run, &amp;amp;ios));
   sleep (1);
   std::cerr &amp;lt;&amp;lt; "interrupting\n"; t.interrupt (); sleep (1);
   return 0;
}

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
asio-users mailing list
asio-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio

&lt;/pre&gt;</description>
    <dc:creator>kir</dc:creator>
    <dc:date>2012-05-15T22:50:00</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5218">
    <title>creating a match object that stops at a characterother than a newline</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5218</link>
    <description>&lt;pre&gt;Hi

How do you create a match functor that stops at a character other than
a newline? I tried this

class DetectTerminator
{
    public:
        explicit DetectTerminator() {}

        template &amp;lt;typename Iterator&amp;gt;
            std::pair&amp;lt;Iterator, bool&amp;gt; operator()(
                    Iterator begin, Iterator end) const
            {
                Iterator i = begin;
                while (i != end)
                {
                    if ('\n' == *i || '?' == *i)
                    {
                        BOOST_LOG_TRIVIAL(info) &amp;lt;&amp;lt; "detected " &amp;lt;&amp;lt; int(*i);
                        return std::make_pair(i, true);
                    }
                    else
                    {
                        i++;
                    }
                }
                return std::make_pair(i, false);
            }
};
namespace boost { namespace asio {
  template &amp;lt;&amp;gt; struct is_match_condition&amp;lt;DetectTerminator&amp;gt;
    : public boost::true_type {};
} }


but it doesn't callback to the read completion handler when a '?' is
entered. The callback is only invoked after I hit enter.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
asio-users mailing list
asio-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio

&lt;/pre&gt;</description>
    <dc:creator>Sashan Govender</dc:creator>
    <dc:date>2012-05-13T10:21:16</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5217">
    <title>Can we mix synchronous accept, connect and handshake (ssl) with async read and write on the same io_service</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5217</link>
    <description>&lt;pre&gt;Dear Chris,

Our use case requires us to build the timeout in the read and write calls
and therefore we wrote them as async_read and async_write.  However, at the
higher level where we perform accept and handshake (we are using ssl), we
are still using the synchonous version of accept and handshake of the
ssl::stream class.  There is a singleton io_service in this case.  So, our
flow goes like:

- start the main event loop by calling io_service.run() with some dummy
work so it never exits the loop
- call accept which is blocked waiting for the next incoming message
- once the message arrives, we create a new socket of type
boost::asio::ssl::stream&amp;lt;boost::asio::ip::tcp::socket&amp;gt; that embeds this
singleton io_service and pass the newly created socket to the worker thread
- Inside this worker thread, we
    * perform handshake() on the ssl context with the caller and then,
    * call async_read and async_write with their corresponding handlers
properly implemented (thread safe) and the worker thread is then blocked
for either the timer or the handler to return (since the event loop was
already created, we don't need to call another io_service.run())

Although it seemed to work with small number of incoming requests, with
large volume of requests, we are seeing consistent seg faults in the
handshake call and sometimes in the async_read call.  So, question with
regard to the above design:
- Are we doing something drastically wrong which violates the asio async
model?
- Is it safe to have all of the threads operating on the same io_service
like our design above (which has a mixture of sync and async calls going on
concurrently), even tho they have their own sockets?

BTW, I saw that you have some commercial support package available and I'd
like to explore the terms of it...

Thanks,
Rene
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
asio-users mailing list
asio-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio
&lt;/pre&gt;</description>
    <dc:creator>Rene Zhu</dc:creator>
    <dc:date>2012-05-11T19:22:38</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5215">
    <title>boost::asio over SocketCAN</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5215</link>
    <description>&lt;pre&gt;Hello,

I was thinking of making use of boost asio to read data from a Socket CAN [1].
There's nothing fancy going on in &amp;lt;linux/can.h&amp;gt;, and the device should
behave like a raw socket.

Looking at the basic_socket interface it seems that I can make use of
basic_raw_socket::assign [2] to assign the native socket created with

socket( PF_CAN, SOCK_RAW, CAN_RAW );

This is what I have so far

namespace can {
class CanSocket {
public:
typedef boost::asio::ip::basic_endpoint&amp;lt;CanSocket&amp;gt; endpoint;
typedef boost::asio::ip::basic_resolver_query&amp;lt;CanSocket&amp;gt; resolver_query;
typedef boost::asio::ip::basic_resolver_iterator&amp;lt;CanSocket&amp;gt; resolver_iterator;
typedef boost::asio::basic_raw_socket&amp;lt;CanSocket&amp;gt; socket;
typedef boost::asio::ip::basic_resolver&amp;lt;CanSocket&amp;gt; resolver;

CanSocket()
: _protocol( CAN_RAW )
, _family( PF_CAN )
{
}

static CanSocket v4()
{
return CanSocket();
}
static CanSocket v6();
int type() const;
int protocol() const;
int family() const;

friend bool operator==(const CanSocket&amp;amp; p1, const CanSocket&amp;amp; p2)
{
return p1._protocol != p2._protocol || p1._family != p2._family;
}
friend bool operator!=(const CanSocket&amp;amp; p1, const CanSocket&amp;amp; p2)
{
return p1._protocol == p2._protocol || p1._family == p2._family;
}

private:
int _protocol;
int _family;
};
}

And this is how I use it in my application

    boost::asio::io_service ioserv;

    CanSocket::socket s( ioserv );

    int sock = socket( PF_CAN, SOCK_RAW, CAN_RAW );

    s.assign(CanSocket::v4(), sock);

   struct ifreq ifr;
   strcpy(ifr.ifr_name, "vcan0");
   ioctl(sock, SIOCGIFINDEX, &amp;amp;ifr); /* ifr.ifr_ifindex gets filled
                                  * with that device's index */

   /* Select that CAN interface, and bind the socket to it. */

   /* this should be the endpoint */
   struct sockaddr_can addr;
   addr.can_family = AF_CAN;
   addr.can_ifindex = ifr.ifr_ifindex;

   /* s.bind (....) */
   bind( sock, (struct sockaddr*)&amp;amp;addr, sizeof(addr) );


What I don't quite get is how do I bind s to the local endpoint? There
are no IPs or ports involved.

Is there anything else that should be implemented besides the endpoint
to get it going?

Regards,


[1] http://en.wikipedia.org/wiki/SocketCAN
[2] http://www.boost.org/doc/libs/1_49_0/doc/html/boost_asio/reference/basic_socket.html

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
asio-users mailing list
asio-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio

&lt;/pre&gt;</description>
    <dc:creator>Alin Rus</dc:creator>
    <dc:date>2012-05-06T00:29:33</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5214">
    <title>Using asio from within a node.js module</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5214</link>
    <description>&lt;pre&gt;I've got a middleware library that I use to communicate with a server using
 both synchronous and asynchronous socket IO.  I've had really good luck
with this architecture, embedding the middleware in multithreaded C++/Qt 
applications and python; however, I'm really struggling getting it to work
with the middleware lib loaded in a node.js module.

The node community hasn't been very responsive to my queries, so I'm hoping 
 the asio community can shed some light on this.
 
First of all, I'm using boost::asio 1.47.0 on Red Hat Linux with gcc 4.6.1
and node.js 0.6.12. The first problem I have is that asio routinely seg
faults (but not always) when constructing a basic_io_stream socket.  The
op_queue ends up with gargage pointers in back_.  If it doesn't crash, then
the queue never processes handlers.  I'm pretty sure there is some
threading issue at play here, but I'm not having much luck narrowing it
down.

I've tried a single threaded such that there is only one io_service in the
node module with hopes of just polling manually with the node event loop.
But this still yields non-deterministic memory corruption. Valgrind only
reports uninitialized memory in op_queue - which isn't true - I can step
through and see clearly that the members, and what back_ is assigned to is
initialized.

I've also tried instantiating the io_service and the middleware class from
with a boost::thread blocking on a mutex so that the node module will wait
until construction is fully complete.  This tends to reduce the likelihood
of the seg fault, but it doesn't go away.  It's sooo weird. And even if the
seg faults do not complete, I'm still stuck with the handler problem.  They
will not process.  I'm not familiar at all with epoll() and how it works at
a low level, but I'm beginning to think that it's just not possible to mix
asio with node.  Both are using the epoll() mechanism.  That might be OK if
I could get the middleware module to run in its own thread with blocking IO,
but alas...

Any thoughts out there?  The middleware isn't especially complicated, so I
can rewrite it using native sockets or somthing, but I'd really like to keep
it the same so I can embed it unchanged in a multitude of environments.
 
-stephen



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
asio-users mailing list
asio-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio

&lt;/pre&gt;</description>
    <dc:creator>Stephen Bowline</dc:creator>
    <dc:date>2012-05-04T16:23:52</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5210">
    <title>Asio's HTTP example server slow w/ SSL?</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5210</link>
    <description>&lt;pre&gt;(originally addressed to the code's author, but asio-users moderation 
ate the CC'd version)

Here is a JSON-RPC skeleton HTTP server based upon Boost.Asio example 
http::server3:

     git://github.com/jgarzik/rpcsrv.git

http::server3 was updated to support HTTP/1.1, uploaded content and JSON 
encode/decode.  After that, SSL support was added, using Boost.Asio 
server.cpp example code.

ApacheBench shows 24,000 reqs/second for HTTP.  Impressive!

ApacheBench shows 200 reqs/second for HTTPS (SSL).  Even though the HTTP 
server is using 10 threads, CPU usage is only 50%.

Has anyone heard of this problem before?  rpcsrv.git is based entirely 
upon Boost.Asio example code -- though I admit I probably did something 
stupid and broke it all

Any thoughts or SSL tips/tricks?

Thanks, and kudos on well done http::server3 example code,

     Jeff



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
asio-users mailing list
asio-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio

&lt;/pre&gt;</description>
    <dc:creator>Jeff Garzik</dc:creator>
    <dc:date>2012-05-03T20:42:22</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5207">
    <title>no io_service::wrap(f) ... why?</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5207</link>
    <description>&lt;pre&gt;Hi!

Why is there only a strand::wrap(f) and not an io_service::wrap(f) in the API? That'd be a really useful thing to have.

Every so often you need to call a handler but want to have it dispatched to another io_service. Such a thing is possible using a wrapper and argument forwarding, but I'm just wondering why it was included for strand and not io_service.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
asio-users mailing list
asio-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio

&lt;/pre&gt;</description>
    <dc:creator>Amir Taaki</dc:creator>
    <dc:date>2012-04-26T13:45:23</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5201">
    <title>async_read: illegal instruction</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5201</link>
    <description>&lt;pre&gt;Hi everyone

Since having updated to boost version 1.48, I am experiencing severe  
runtime errors when relying on asynchronous operations. Please consider  
the following code (the important bit is located in ServerReceive’s  
operator() ):

=== main.cpp ================================
#include &amp;lt;boost/asio/ip/tcp.hpp&amp;gt;
#include &amp;lt;boost/asio/write.hpp&amp;gt;
#include &amp;lt;boost/asio/read.hpp&amp;gt;
#include &amp;lt;boost/exception/all.hpp&amp;gt;
#include &amp;lt;boost/lexical_cast.hpp&amp;gt;
#include &amp;lt;boost/thread.hpp&amp;gt;

using namespace boost;
using namespace boost::asio;
using namespace boost::posix_time;
using namespace boost::system;
using namespace std;

namespace {

const char * const CONNECTION_UNAVAILABLE("error.connection-unavailable");
const char * const RESOLVE_ERROR("error.resolve");
struct host_name;
struct port_value;

ip::tcp::endpoint createEndpoint(const string &amp;amp;hostName, unsigned int  
port) {
io_service ioService;
ip::tcp::resolver resolver(ioService);
ip::tcp::resolver::query query(hostName, lexical_cast&amp;lt;string&amp;gt;(port),  
ip::tcp::resolver::query::numeric_service);
try {
ip::tcp::resolver::iterator resolve(resolver.resolve(query));
if (resolve != ip::tcp::resolver::iterator()) {
return *resolve;
}
} catch (...) {
error_info&amp;lt;host_name, string&amp;gt; nameInfo(hostName);
error_info&amp;lt;port_value, unsigned int&amp;gt; portInfo(port);
exception_ptr nested(current_exception());
runtime_error error(RESOLVE_ERROR);
BOOST_THROW_EXCEPTION(enable_error_info(error) &amp;lt;&amp;lt; nameInfo &amp;lt;&amp;lt; portInfo &amp;lt;&amp;lt;  
errinfo_nested_exception(nested));
}
error_info&amp;lt;host_name, string&amp;gt; nameInfo(hostName);
error_info&amp;lt;port_value, unsigned int&amp;gt; portInfo(port);
BOOST_THROW_EXCEPTION(enable_error_info(runtime_error(CONNECTION_UNAVAILABLE))  
&amp;lt;&amp;lt; nameInfo &amp;lt;&amp;lt; portInfo);
}

class ServerReceive {
private:
volatile bool ready;
string result;
public:
ServerReceive() :
ready(false) {
}
~ServerReceive() {
}
void operator()() {
io_service io;
try {
ip::tcp::socket socket(io);
ip::tcp::acceptor acceptor(io, ip::tcp::endpoint(ip::tcp::v4(), 32768));
acceptor.listen();
ready = true;
acceptor.accept(socket);
char data[] = { '\0', '\0', '\0', '\0', '\0' };
// SYNCHRONOUS CALL
read(socket, buffer(data, 4));
// SYNCHRONOUS CALL
result = data;
} catch (const std::exception &amp;amp;ex) {
result = ex.what();
ready = true;
}
}

const string &amp;amp;getResult() const {
return result;
}

volatile bool isReady() const {
return ready;
}
};

}

int main(int argc, char *argv[]) {
ServerReceive serverReceive;
thread server(ref(serverReceive));
while (!serverReceive.isReady()) {
this_thread::sleep(milliseconds(100));
}
io_service io;
ip::tcp::socket socket(io);
socket.connect(createEndpoint("127.0.0.1", 32768));
asio::write(socket, buffer("asdf", 4));
server.join();
cout &amp;lt;&amp;lt; "Result: " &amp;lt;&amp;lt; serverReceive.getResult() &amp;lt;&amp;lt; endl;
}
=== main.cpp ================================


While this example works like a charm:
=== output ==================================
root&amp;lt; at &amp;gt;target:/tmp/sync# ./sync
“Result: asdf”
=== output ==================================

Using an equivalent asynchronous operation will result in an “illegal  
instruction” error:
void onSuccess(const error_code &amp;amp;error, size_t bytes_transferred) {
=== main.cpp ================================
// ...
}
// ...
async_read(socket, buffer(data, 4), &amp;amp;onSuccess);
io.run();
=== main.cpp ================================

=== output ==================================
root&amp;lt; at &amp;gt;target:/tmp/async# ./async
Illegal instruction
=== output ==================================

I am compiling the executable with the following gcc 4.4.2 command:

=== command =================================
xscale-linux-g++ -fPIC -DBOOST_ASIO_DISABLE_EPOLL  
-I/var/lib/c++/boost/boost_1_48_0/target/arm-linux-4.4.2/include -oasync  
main.cpp  
-L/var/lib/c++/boost/boost_1_48_0/target/arm-linux-4.4.2/lib/static  
-pthread -lboost_system -lboost_thread
=== command =================================

Is this a common or known issue and does anyone have any idea as to how to  
address it?

Thanks for any hints and best regards
Pascal


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
asio-users mailing list
asio-users&amp;lt; at &amp;gt;lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio
&lt;/pre&gt;</description>
    <dc:creator>Pascal Kesseli</dc:creator>
    <dc:date>2012-04-23T09:25:56</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5198">
    <title>io_service post handler copy performance</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5198</link>
    <description>&lt;pre&gt;When I test io_service performance(windows),
I find the Handler copy 4 times by call stack.
Can I pass 1 and 4 handler by reference in stead of by value?
If no, any reason? thanks!

1 and 2 is post call

1.
template &amp;lt;typename Handler&amp;gt;
void win_iocp_io_service::post(Handler handler)  // here handler copy

2.
completion_handler(Handler&amp;amp; h)
    : operation(&amp;amp;completion_handler::do_complete),
      handler_(BOOST_ASIO_MOVE_CAST(Handler)(h))  // here handler_ copy
{
}

3 and 4 is call when complete

3.
static void do_complete(io_service_impl* owner, operation* base,
      const boost::system::error_code&amp;amp; /*ec*/,
      std::size_t /*bytes_transferred*/)
  {
    // Take ownership of the handler object.
    completion_handler* h(static_cast&amp;lt;completion_handler*&amp;gt;(base));
    ptr p = { boost::addressof(h-&amp;gt;handler_), h, h };

    BOOST_ASIO_HANDLER_COMPLETION((h));

    // Make a copy of the handler so that the memory can be deallocated
before
    // the upcall is made. Even if we're not about to make an upcall, a
    // sub-object of the handler may be the true owner of the memory
associated
    // with the handler. Consequently, a local copy of the handler is
required
    // to ensure that any owning sub-object remains valid until after we
have
    // deallocated the memory here.
    Handler handler(BOOST_ASIO_MOVE_CAST(Handler)(h-&amp;gt;handler_)); // here
handler copy

4.
template &amp;lt;typename Function&amp;gt;
inline void asio_handler_invoke(Function function, ...) // here function
copy
{
  function();
}
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2_______________________________________________
asio-users mailing list
asio-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio
&lt;/pre&gt;</description>
    <dc:creator>he keding</dc:creator>
    <dc:date>2012-04-20T07:16:27</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5188">
    <title>Hanging dead connections.</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5188</link>
    <description>&lt;pre&gt;Hello.
Sometimes TCP connection isn't closed on server side even after client
application closing. Client computer reboot does not help, connection will
hang endlessly.
Is there something to do with it, adjust some settings?
------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev_______________________________________________
asio-users mailing list
asio-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio
&lt;/pre&gt;</description>
    <dc:creator>Slav</dc:creator>
    <dc:date>2012-04-17T15:01:58</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5187">
    <title>test boost example server3: sometimes lost the requestdata</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5187</link>
    <description>&lt;pre&gt;Hi,

   I had encouraged an issue when I used the asio example server3, would
you please help me to analyze what's happen in this case, the case like
this:

*******************************************************

   Client code:

              Main()

              {

                     creat();

                     Bind();

                     Listen();

                     Accept();

                     While( true)

                     {

                            Send_request();

                            Recv_response();

                            //Process_response();

}

              }

******************************************************

       Well, when I start the client, we could send some requests to the
server and we also could receive the responses. But, some minutes later,
the client block in the recv() API in recv_response() function. While this
time , we use the tcpdump to capture the package at both the server side and
client side, we found that the client had already sent the request to the
server, and the protocol stack on the server side had already received the
request data.

       At this time, if we use the GDB to monitor the stack of the server3, we
found that there is a thread block on epoll_wait function, my problem is
that:

1.    The data had already received by the kernel protocol stack, why the
epoll_wait function couldn’t return?

2.    Is this issue relation to the ET(Edge Trigger) mode epoll?

3.    We found that we can reproduce this problem when we set the server
with multiple thread mode easily. And so far, we had not reproduced this when
we set the server with single thread mode. I think if this problem is
relate to the ET mode of epoll, reproduce that in the single thread just a time
problem, am I right??

4.    Is there has a switch for the ET or LT for epoll in 1.49 asio???





Thanks very much.





       Verient
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
asio-users mailing list
asio-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio
&lt;/pre&gt;</description>
    <dc:creator>zhongwang huang</dc:creator>
    <dc:date>2012-04-16T01:25:46</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5179">
    <title>asio: read or write with timeout?</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5179</link>
    <description>&lt;pre&gt;Been using ASIO for the past 18 months or so, works great on Linux,
Windows, and Mac, so for that I thank you!  Using it a bit for things like
name resolution, but mostly using it for UDP, TCP, and SSL sockets.

All the socket read + writes used so far in this app are of this style:

http://www.boost.org/doc/libs/1_49_0/doc/html/boost_asio/reference/basic_stream_socket/read_some/overload2.html
http://www.boost.org/doc/libs/1_49_0/doc/html/boost_asio/reference/basic_stream_socket/write_some/overload2.html

Problem is when network connectivity interrupts communication between
clients and servers.  App needs to jump in and do some recovery long before
the 13 or 15 minute timeout finally takes effect.  So I'm now looking
though the reference docs thinking: "there's probably an override for those
methods that takes some kind of timeout value...  Maybe takes an absolute
boost::posix_time::ptime or better yet a simple relative
boost::posix_time::time_duration as a "timeout" parameter.

But I cannot find anything of the sort.  From what I can tell, there is no
way to specify a timeout on any of the read or write calls I see.  Am I
missing something obvious, or is there really no way to specify a timeout
when doing socket read and socket writes?

Thanks for any hints!

Stéphane
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2_______________________________________________
asio-users mailing list
asio-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio
&lt;/pre&gt;</description>
    <dc:creator>Stéphane Charette</dc:creator>
    <dc:date>2012-04-14T08:29:13</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5177">
    <title>asio::deadline_timer does not call the handler if Ichange the time back</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5177</link>
    <description>&lt;pre&gt;This simple code does not call the handler print () if I change the time back.
Is this normal?
How can I fix this behavior?

#include &amp;lt;iostream&amp;gt;
#include &amp;lt;boost/asio.hpp&amp;gt;

void print(const boost::system::error_code&amp;amp; /*e*/) {
   std::cout &amp;lt;&amp;lt; "Hello, world!" &amp;lt;&amp;lt; std::endl;
}

int main() {
   boost::asio::io_service io;

   boost::asio::deadline_timer t(io, boost::posix_time::seconds(5));
   t.async_wait(print);

   io.run();
   return 0;
}

http://liveworkspace.org/code/5e35baafe00a0a7a47f51347a92d9110

Thanks.

&lt;/pre&gt;</description>
    <dc:creator>niXman</dc:creator>
    <dc:date>2012-04-14T07:49:19</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5172">
    <title>Relax CompletionHandler copy-constructable requirement</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5172</link>
    <description>&lt;pre&gt;A natural fit to execute tasks asynchronously is via io_service::post.
Asio already supports moveable handlers and is on its way to integrate
nicely with C++11. Ideally, I would like to do this:

    template &amp;lt;typename F&amp;gt;
    std::future&amp;lt;typename std::result_of&amp;lt;F()&amp;gt;::type&amp;gt;
    schedule(F f)
    {
        typedef typename std::result_of&amp;lt;F()&amp;gt;::type result_type;
        std::packaged_task&amp;lt;result_type&amp;gt; task(f);
        std::future&amp;lt;result_type&amp;gt; future = task.get_future();

        io_service_.post(std::move(task)); // Impossible,
CompletionHandler requires copy-contruction.

        return std::move(future);
    }

Are there any plans to relax the CompletionHandler copy-constructable
requirement? For example, I could imagine on overload for
io_service::post that takes an rvalue reference. This would ensure
backwards compatibility while supporting idioms like shown above.

    Matthias

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
asio-users mailing list
asio-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio

&lt;/pre&gt;</description>
    <dc:creator>Matthias Vallentin</dc:creator>
    <dc:date>2012-04-11T18:41:43</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5155">
    <title>reusing SSL sessions in ASIO sockets</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5155</link>
    <description>&lt;pre&gt;I have  a C++ app that connects to FTP-Secure servers.  Some of these
servers seem to expect the clients to re-use/share/resume (?) the SSL
session between the control and data connections.  This way the server
doesn't have to perform the expensive SSL handshake on every connection.  I
have my client code working on Linux, but I suspect I haven't done it
right.  When the same code runs on a Mac, it doesn't work at all.  The 2nd
connection fails to establish, getting stuck in the SSL handshake.

I'm definitely not an expert with OpenSSL nor ASIO, so I'm hoping someone
more knowledgable will be able to point out my mistake.

To illustrate the problem, I've written a sample app that shows this
problem.  The sample source is available here:
http://charette.no-ip.com:81/asio-openssl/

Here is how I setup the SSL CTX:

C::C( void ) :
        ioservice( 2 ),
        sslcontext( ioservice, boost::asio::ssl::context::sslv23 ), // only
use 1 SSL context
        sslControlSocket( ioservice, sslcontext ),
        sslDataSocket( ioservice, sslcontext )
{
// ...what does "default_workarounds" do?
sslcontext.set_options( boost::asio::ssl::context::default_workarounds |
boost::asio::ssl::context::verify_none );

SSL_CTX *ctx = sslcontext.impl();

// example to show how to change timeout from default value of 300s to 600s
SSL_CTX_set_timeout( ctx, 600 );

// to share the session, we need to ensure the SSL CTX is using CACHE_CLIENT
long mode = SSL_CTX_get_session_cache_mode( ctx );
mode |= SSL_SESS_CACHE_CLIENT;
SSL_CTX_set_session_cache_mode( ctx, mode );

Then when it is time to setup the 2nd SSL connection, here is how I tried
to copy the SSL session from control connection to the data one:

sslDataSocket.next_layer().connect( endpoint, ec );
if ( ec ) throw std::runtime_error("data socket: failed to connect");

SSL *ctrlSSL = sslControlSocket.impl()-&amp;gt;ssl;
SSL *dataSSL = sslDataSocket.impl()-&amp;gt;ssl;

std::cout &amp;lt;&amp;lt; "Copy the existing SSL session from the control socket." &amp;lt;&amp;lt;
std::endl;
SSL_SESSION *session = SSL_get1_session( ctrlSSL );

std::cout &amp;lt;&amp;lt; "Reuse the SSL session by setting it into the passive data SSL
channel." &amp;lt;&amp;lt; std::endl;
int rc = SSL_set_session( dataSSL, session );
if ( rc != 1 ) throw std::runtime_error( "failed to set the data channel
ssl session" );

std::cout &amp;lt;&amp;lt; "Make the call to SSL_connect(), and..." &amp;lt;&amp;lt; std::endl;
// we shouldn't have to call sslDataSocket.handshake() or SSL_handshake();
// instead, we call SSL_connect() after which the connection should be
functional
rc = SSL_connect( dataSSL );

Can anyone point me in the right direction?  Thanks!

Stéphane
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2_______________________________________________
asio-users mailing list
asio-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio
&lt;/pre&gt;</description>
    <dc:creator>Stéphane Charette</dc:creator>
    <dc:date>2012-04-08T04:52:47</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5142">
    <title>Detecting TCP disconnection...</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5142</link>
    <description>&lt;pre&gt;
I'm using the asynchronous facility of boost::asio 1.48 on Linux.  My 
question is: if I have an idle TCP connection (no sends and receives) 
and the connection suddenly goes down, how would the endpoints (sender 
or receiver) know?  In other words, does the io_service know that the 
connection went down?

Thanks much



------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
asio-users mailing list
asio-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f&amp;lt; at &amp;gt;public.gmane.org
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio

&lt;/pre&gt;</description>
    <dc:creator>barcaroller</dc:creator>
    <dc:date>2012-04-01T15:45:26</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5133">
    <title>boost asio overhead/scalability</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/5133</link>
    <description>&lt;pre&gt;Hi,

I have been trying to look at how much overhead boost asio introduces
and how it scales to multiple cores.

Essentially, I have written a small test program that just
sends/receives 4-byte packets between a datagram unix-domain
socketpair (this is on a quad-core Intel i7-2600K &amp;lt; at &amp;gt; 3.4 Ghz with
hyperthreading enabled and Linux 3.0). I am comparing a simple
blocking recv/send version (1 thread per socketpair) with a
hand-written edge-triggered epoll loop, a simple async I/O abstraction
library (using edge-triggered epoll) and boost asio (1.46) when
increasing the number of worker threads.

I have run this with 1 socketpair and 16 socketpairs (to get some
concurrency in the latter case):

- http://www.editgrid.com/export/sheetobject/41780862.png
- http://www.editgrid.com/export/sheetobject/41780860.png

As there isn't any concurrency when there is only a single socketpair,
I don't expect any speedup when increasing the number of threads, but
with boost asio I am seeing a very significant slowdown here. And even
with 16 socketpairs, I am still seeing a quite significant slowdown
for boost asio - when the other options show a speedup.

BTW, source code for the test programs is available from:

- http://svn.cmeerw.net/src/nginetd/trunk/test/mttest.cc
- http://svn.cmeerw.net/src/nginetd/trunk/test/eptest.cc
- http://svn.cmeerw.net/src/nginetd/trunk/test/asiosrv.cc
- http://svn.cmeerw.net/src/nginetd/trunk/asyncsrv.cc


Christof

&lt;/pre&gt;</description>
    <dc:creator>Christof Meerwald</dc:creator>
    <dc:date>2012-03-25T16:55:34</dc:date>
  </item>
  <textinput rdf:about="http://search.gmane.org/?group=$group=gmane.comp.lib.boost.asio.user">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.comp.lib.boost.asio.user</link>
  </textinput>
</rdf:RDF>

