Boost logo

Boost :

From: Scott (cheesy4poofs_at_[hidden])
Date: 2006-09-29 09:29:04


Hi Chris,

>
> In the client, I have 2 threads. The main thread is the one
> that sends
> random messages to the server. The other thread handles all incoming
> responses and prints out the number of bytes received. Both
> threads share
> the same io_service. It is my understanding from the docs
> that multiple
> threads can all share an io_service, but please let me know
> if the code is
> incorrect.

I started thinking about my own client code and read up on the socket class.
The docs say the socket object is unsafe for shared objects. So I put locks
around every async_read or async_write operation. However, it still fails.

Is the problem with my code the fact that 2 threads are using the same
socket? Is that just not possible?

Thanks,
Scott




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk