|
Boost Users : |
Subject: [Boost-users] socket reconnection
From: boost001 (oldyoungguy88_at_[hidden])
Date: 2008-12-09 14:59:35
I have an ASIO socket server. I need to close the socket and then listen to
the socket again if client disconnected from server.
When the server was started, the socket and acceptor are initialized like
this:
asio_socketPtr = new tcp::socket(asio_service);
asio_acceptorPtr = new tcp::acceptor(asio_service, tcp::endpoint(protocol,
m_iPort));
in the process closing the socket, I did the following in order:
asio_acceptorPtr->close(error_closing);
asio_socketPtr->shutdown(tcp::socket::shutdown_both, error_closing);
asio_socketPtr->close(error_closing);
in the process reopen the socket, I did the following in order:
asio_socketPtr->open(protocol, error_connecting);
asio_acceptorPtr->open(protocol, error_connecting);
but I always got error. the error code is 1. It means Operation not
permitted. Did I miss something? Do I need to delete above socketPtr and
acceptorPtr and create new one each time?
thanks,
-- View this message in context: http://www.nabble.com/socket-reconnection-tp20922241p20922241.html Sent from the Boost - Users mailing list archive at Nabble.com.
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