int StreamSocketImpl::sendBytes(const void* buffer, int length, int flags) { const char* p = reinterpret_cast<const char*>(buffer); int remaining = length; int sent = 0; while (remaining > 0 && getBlocking()) { int n = SocketImpl::sendBytes(p, remaining, flags); if (n <= 0) return n; p += n; remaining -= n; sent += n; } return sent; }
int StreamSocketImpl::sendBytes(const void* buffer, int length, int flags) { const char* p = reinterpret_cast<const char*>(buffer); int remaining = length; int sent = 0; bool blocking = getBlocking(); while (remaining > 0) { int n = SocketImpl::sendBytes(p, remaining, flags); poco_assert_dbg (n >= 0); p += n; sent += n; remaining -= n; if (blocking && remaining > 0) Poco::Thread::yield(); else break; } return sent; }
int SecureStreamSocketImpl::sendBytes(const void* buffer, int length, int flags) { const char* p = reinterpret_cast<const char*>(buffer); int remaining = length; int sent = 0; bool blocking = getBlocking(); while (remaining > 0) { int n = _impl.sendBytes(p, remaining, flags); if (n < 0 && !blocking) return n; if (n > 0) { p += n; sent += n; remaining -= n; } if (blocking && remaining > 0) Poco::Thread::yield(); else break; } return sent; }