// Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-// Definition of non-inline template functions
+/** \file
+ \brief senf::ClientSocketHandle non-inline template implementation
+ */
//#include "ClientSocketHandle.ih"
unsigned nread = available();
if (limit>0 && nread>limit)
nread = limit;
- // FIXME: This is not necessary correct and more or less a hack ...
+ /** \fixme This is not necessary correct and more or less a hack ... */
buffer.assign(nread,0);
unsigned rv = this->read(const_cast<char *>(buffer.data()),nread);
if (rv < nread)
readfrom(std::string & buffer, typename Policy::AddressingPolicy::Address & from)
{
unsigned nread = available();
- // FIXME: This is not necessary correct and more or less a hack ...
+ /** \fixme This is not necessary correct and more or less a hack ... */
buffer.assign(nread,0);
unsigned rv = this->readfrom(const_cast<char *>(buffer.data()), nread, from);
if (rv < nread)
{
unsigned nread = this->protocol().available();
if (nread == 0 && this->blocking()) {
- this->waitReadable();
- nread = this->protocol().available();
+ // We have to block explicitly here so we can return the
+ // number of bytes available explicitly. If no more date can
+ // be expected to arive (i.e. the other end has closed the
+ // connection), the socket will always be in the readable
+ // state. This is the only case when available() will return
+ // 0.
+ this->waitReadable();
+ nread = this->protocol().available();
}
return nread;
}