|
Boost Users : |
Subject: Re: [Boost-users] [asio] How to handle 'Bad file descriptor'
From: Igor R (boost.lists_at_[hidden])
Date: 2013-02-03 15:50:09
> I have problems to understand, what might causing a 'Bad file descriptor' exception to be thrown in my application.
> The exception is most likely thrown by a call to tcp::socket::close. From the logs I have, I'm quit certain, that
> the last function calls on a socket are:
>
> s.shutdown(tcp::socket::shutdown_receive);
> s.shutdown(tcp::socket::shutdown_send);
> s.close(); // first time to cancel outstanding handlers
> s.close(); // a second time, later in the d'tor
>
> I'm not sure, whether it's the first or the second call to close(), that causes the exception.
>
> But what does 'Bad file descriptor' mean in this context? Is the underlying socket is somehow broken/corrupted? If so, there must be
> a bug in my code. If not, is it save to simply ignore the error?
It means that tcp::socket is closed (and the underlying native
descriptor is something like -1).
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