问题
Please refer to the ASIO examples at : http://www.boost.org/doc/libs/1_57_0/doc/html/boost_asio/examples/cpp03_examples.html
The connection class code is at : http://www.boost.org/doc/libs/1_57_0/doc/html/boost_asio/example/cpp03/http/server/connection.cpp
This class has a stop() function which calls stop on socket that has been created corresponding to a connection request to server (from void server::start_accept())
The client code resides at : http://www.boost.org/doc/libs/1_57_0/doc/html/boost_asio/example/cpp03/http/client/sync_client.cpp
This class also creates a socket at the client end, but this code does not close the socket.
My question is that there are 2 sockets that are opened: from client to server and vice-a-versa
So, I have 2 questions :
a) Is just closing the socket which the server has opened sufficient or should we also call close on the socket inside the client code ?
b) Should we call shutdown on socket before calling close ?
来源:https://stackoverflow.com/questions/48267854/asio-client-server-shutdown