I'm having trouble when in Windows XP, try to connect a socket to an endpoint after being connected to another.

This is the situation:

a) The boost::asio::ip::tcp::socket is connected to a remote host (say pop.remote1.com).

b) The transmission ends, and the socket is closed:

     socket_.shutdown(boost::asio::ip::tcp::socket::shutdown_both, error);
     socket_.close(error);

Then, when trying to connect to another host (say pop.remote2.com) using the same process that in a), the proccess returns without error, but the socket remains closed.

Note that when using pop.remote2.com as the first connection, the things run Ok, and the same problem arises if try to connect to pop.remote1.com after closing.

In both situations there are not pending processes in the attached io_service.

I tried to open the socket before the reconnection, but the result remains the same. That is, the result is the same if after closing the previous connection with.

     socket_.shutdown(...);
     socket_.close(...);

is used

     socket_.open(...);
     socket_.async_connect( ... );

or just

     socket_.async_connect( ... );


The questions are:

Is that reconnection admissible?

Is that the supposed correct process?

Thanks in advance.