libssh2_channel_flush_ex(3)

πŸ“¦
version 1.11.1 Β· 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, debian trixie, epel 10, epel 9, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ NAME ✨

libssh2_channel_flush_ex β€” bestie, it flushes a channel πŸ’…

(also living in the libssh2 manual, section 3, if you were wondering where to find her)


🌸 SYNOPSIS 🌸

#include <libssh2.h>

int
libssh2_channel_flush_ex(LIBSSH2_CHANNEL *channel, int streamid);

int
libssh2_channel_flush(LIBSSH2_CHANNEL *channel);

int
libssh2_channel_flush_stderr(LIBSSH2_CHANNEL *channel);

πŸ’– DESCRIPTION πŸ’–

okay so, three whole functions, and they're all about dumping the read buffer. iconic.

Here's the tea on the arguments:

  • channel β€” the active channel stream you wanna flush, babes. like, the one that's actually live.
  • streamid β€” the specific substream number to flush. and here's the cute part: you can flush whole groups of substreams by passing one of these constants πŸ‘‡
    • LIBSSH2_CHANNEL_FLUSH_EXTENDED_DATA β€” flushes all the extended data substreams ✨
    • LIBSSH2_CHANNEL_FLUSH_ALL β€” flushes literally every substream, all of them, no survivors 🫢

So what does it actually do? It flushes the read buffer for a given channel instance. that's it, that's the whole vibe. You can flush individual substreams by number, or you can use one of the provided macros if you're feeling fancy. main character choice, honestly.


πŸ”₯ RETURN VALUE πŸ”₯

It returns the number of bytes flushed πŸŽ€ β€” or a negative number if things went sideways, which… 😭.

Heads up bestie: it returns LIBSSH2_ERROR_EAGAIN when it would otherwise block. And yes, LIBSSH2_ERROR_EAGAIN is technically a negative number, but it's not really a failure per se. don't panic. she's just saying "not right now" πŸ’€. vibe check passed, fr fr.

and that's the whole page, no cap. this was libssh2 0.15, dated 1 Jun 2007 β€” yeah she's an elder but she still slays πŸ‘‘. mwah, go flush something πŸ’œ