
Shenyu Yao
everytime you instantiate a new socket object with a constructor including a io_service object, this socket object is associated with the io_service object, since I only have one io_service object, these socket object will be executed when I call io_service.run() but, the question is, how do i assign handle_function to those socket, I saw people use acceptor.async_accept(socket, boost::bind (handler, &socket)) like this, But I want to use accept rather than async_accept(), but the accept() function cant be used to bind a handler function to this socket
Use asynchronous methods if you only want to use one thread, otherwise use synchronous (blocking) methods and create a thread per connection. There are many asio examples showing how to do both. Sam