Boost logo

Boost Users :

Subject: [Boost-users] Reusing IOService Object
From: Tim Pynegar (tim_at_[hidden])
Date: 2008-10-27 14:37:45


Hi,

I'm having an issue starting then stopping and trying to restart a
socket or rather the IOService that's being used to service that socket.

The IOService and Socket are member's of my class that has a run method
itself that is on a separate thread.

In my class constructor the Socket is passed into the IOService constructor.

The sequence is as follow's

Socket.Open
Socket.Bind
Socket.async_recieve_from

Thread Start ------

IOService.Run

Socket.Close

IOService.Stop ( the thread terminates due to the IOService.Run method
completing )

Socket.Open
Socket.Bind
Socket.async_recieve_from

Thread Start ------

IOService.Run

This then return's immediately due to a "stopped" long in IOService ( on
windows ) being set to 1.

So my question is really am i trying to use these in the wrong way as in
should i construct a new Socket and IOService for each
time i want to start them or is there some way to reset the IOService to
it's original state beyond calling IOService.Stop.

Thanks,
Tim.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net