|
Boost Users : |
Subject: Re: [Boost-users] Socket iostream Question
From: Rudolf Leitgeb (r.leitgeb_at_[hidden])
Date: 2009-04-01 03:21:27
> Diagnosing and reporting failures connecting to servers are
> problematic.
> Basically, if a connect fails, the only way to know about it is to
> check the
> fail bit of the iostream. It would be nice to know why a client is
> unable to
> connect. So, to that end, I thought I could construct the iostream
> object
> via the default constructor, grab its streambuf via the rdbuf() call
> and in
> turn grab a basic_socket object reference to the streambuf and then
> call
> connect() on it, i.e.,
Wouldn't it be easier to extract the fileno from the stream and query
the error with getsockopt ? With this approach you could stay fully
asynchronous yet get the real error code if a connection attempt fails.
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