I've been playing around with converting a winsock program over to the Boost ASIO library. The original program had a class that handled connecting to a server and the basic read/write functions. The data was always passed back to the main function in order to let it handle the processing. I would like to keep this generic socket implementation but ASIO is giving me fits.

The asynchronous IO requires handlers and seemingly these handlers have to be chained together, otherwise the ioservice object runs out of things to do an exits. The problem is that this would require me to do the processing within the the socket class that I've created, which I want to avoid because then the code becomes implementation specific.

One of the biggest problems is that the ASIO documentation is minimal. This question is kind of broad but for anyone that has ever used the library before, how would you implement something like I mentioned above with ASIO. I thought about pointers to functions but that seems to create unnecessary complication, which is also undesirable.