Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multithreaded server with boost.Asio [closed]

I'm trying to make a server that receives many connections and handle it. I think it's better if i put each connection in a thread, but I don't know how to do it, cause i still don't know how i tell my class "i receive a new connection, put it into a thread". I'm very confused and still don't found it in none of other posts here. Please, help me.

obs.: I had a hint which create a bunch of connections and so wait for the client, but i don't want to do this, I want to create a connection only if there is someone trying to enter in my server.

like image 329
lucastamoios Avatar asked Oct 17 '25 10:10

lucastamoios


1 Answers

The Boost::Asio documentation's asynchronous TCP daytime server tutorial describes exactly how to write such a server.

Further, there are a number of multithreaded examples in among all the rest.

like image 81
greyfade Avatar answered Oct 19 '25 01:10

greyfade