Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost ASIO - SO_LINGER Socket option is not working
From: Nick Aschberger (nick.aschberger_at_[hidden])
Date: 2009-05-31 21:05:50


Igor R wrote:
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.
    

SO_LINGER is just forwarded as-is to the native socket API, so if it
doesn't work there's some problem with the socket.
What I couldn't understand from your description is whether you used
sync. or async. i/o, and from what thread (same as close() or some
other). Could you please clarify these points?
Hi Igor,

There is only one thread in this program, and we are using sync (blocking) accesses.
So it is definately the same thread that writes some data on the socket and then deletes the socket.

Am I setting the property correctly on the socket? Does it need to be set on the acceptor or something instead/as well?

cheers

Nick

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