
Hi All, I have a situation where at termination of my program, I am closing my socket, and then deleting the socket object. Note, we are using non-asynchronous (blocking) accesses at this point, boost is version 1.36. In some cases, the socket has had some data written to it, but that data is never received by the connected client - because I destroy the socket before the data is sent. So, SO_LINGER is the socket option that is supposed to solve all my worries (it should wait on close for any unsent data to be sent), however I am using it and there is no effect. I presume because I'm doing something wrong. Here is my psuedo-code flow: /* Creation of socket */ m_socket = new boost::asio::ip::tcp::socket(m_io_service); /* Connect the socket with something like: */ acceptor.accept(*m_socket, error); /* Set SO_LINGER option on connected socket */ boost::asio::socket_base::linger linger_op(true, 2000); m_socket->set_option(linger_op); /* program executes, does some stuff */ /* At termination */ // close the socket m_socket->close(); delete(m_socket); I experimented with m_socket->shutdown() instead of close, and it made little difference. In fact, from the documentation it seems shutdown() is the one I definitely don't want to call, as close() is supposed to wait for data to be sent. If anyone has some suggestions as to what would be correct, I would much appreciate it. cheers Nick Aschberger