<div></div><span style="color: rgb(0, 0, 0); font-family: verdana, arial, helvetica;">Thanks, does spawning a coroutine also spawn a new thread? I'd be inclined to think so from what you told me&nbsp;</span><br>
<br>
<blockquote>
----Messaggio originale----<br>
Da: "Oliver Kowalke" &lt;oliver.kowalke@gmail.com&gt;<br>
Data: 10-ott-2016 15.19<br>
A: "boost-users"&lt;boost-users@lists.boost.org&gt;<br>
Ogg: Re: [Boost-users] [ASIO] Do coroutines allow serving multiple clients at once?<br>
<br>
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-10-10 9:44 GMT+02:00 <a href="mailto:mmarkd9@libero.it">mmarkd9@libero.it</a> <span dir="ltr">&lt;<a href="mailto:mmarkd9@libero.it" target="_blank">mmarkd9@libero.it</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div></div>I'd like to know if this code is able to serve multiple clients connecting at the same time to the server.<br></blockquote></div><br></div><div class="gmail_extra">I would say no. You spawn only one coroutine that calls in the for-loop async. operations of accept(), read() and write() in a sequence.<br></div><div class="gmail_extra">No other client is able to connect to your server, e.g. connect() on the client side returns, until you enter accept() again.<br><br></div><div class="gmail_extra">In order to serve multiple clients at the same time you need to spawn a coroutine that accepts new connections and for each client request (read()/write() operations) you need to spawn a new coroutine.<br></div></div>
<br>
</blockquote><br>