libssh2_channel_close(3)
π libssh2_channel_close(3) β the libssh2 girlies' guide π
okay bestie, we're doing the libssh2 manual page for libssh2_channel_close, and honestly? it's giving "saying bye to your situationship but they still got your location" energy. let's get into it π«Ά
β¨ NAME β¨
libssh2_channel_close β close a channel π
πΈ SYNOPSIS πΈ
#include <libssh2.h>
int
libssh2_channel_close(LIBSSH2_CHANNEL *channel);
like yes, that's the whole thing, she's simple, she's iconic β¨
π¦ DESCRIPTION π¦
channelβ the active channel stream you want to set to closed status. that's your main character, okay?
So bestie, what this does is close an active data channel. In practice? You're literally sending an SSH_MSG_CLOSE packet over to the remote host, and that packet is basically you going "hey, no further data is coming from me, periodt." π
BUT. And this is the part people miss β the remote host may still send data back until it sends its own close message in response. So it's not a two-way door slam, it's more like you walking out and them still texting. π
If you actually want to wait for the remote end to close its connection too, you gotta follow this command up with libssh2_channel_wait_closed(3). that's the "okay are you done? are we done? hello?" step. no cap.
β RETURN VALUE β
Returns 0 on success, or a negative number on failure. π
It returns LIBSSH2_ERROR_EAGAIN when it would otherwise block. And listen β even though LIBSSH2_ERROR_EAGAIN is a negative number, it is not really a failure per se. it's more like "not right now bestie, try again later" energy. don't panic, she's just busy. π§
π ERRORS π
LIBSSH2_ERROR_SOCKET_SENDβ Unable to send data on socket. that's the "your message didn't send, it's sitting there with the little loading spinner forever" moment. π
π SEE ALSO π
libssh2_channel_open_ex(3)β because every close needs its open, yin and yang, the circle of life, you get it π₯
this page comes to you from the libssh2 manual, version libssh2 0.15, dated 1 Jun 2007 β yeah she's vintage, she's an elder, and she still ate. π mwah, go close some channels responsibly, ily πβ¨
π¦ where this page comes from
- alpine 3.22: libssh2-doc 1.11.1-r3 Β· BSD-3-Clause
- alpine 3.23: libssh2-doc 1.11.1-r4 Β· BSD-3-Clause
- alpine 3.24: libssh2-doc 1.11.1-r4 Β· BSD-3-Clause
- arch rolling: libssh2 1.11.1-7 Β· BSD-3-Clause
- debian trixie: libssh2-1-dev 1.11.1-1+deb13u1 Β· BSD3
- debian trixie: libssh2-1-dev 1.11.1-1+deb13u2 Β· BSD3
- epel 10: libssh2-docs 1.11.1-9.el10_3 Β· BSD-3-Clause
- epel 9: libssh2-docs 1.11.1-9.el9 Β· BSD-3-Clause
- fedora 43: libssh2-docs 1.11.1-4.fc43 Β· BSD-3-Clause
- fedora 43: libssh2-docs 1.11.1-9.fc43 Β· BSD-3-Clause
- fedora 44: libssh2-docs 1.11.1-5.fc44 Β· BSD-3-Clause
- fedora 44: libssh2-docs 1.11.1-9.fc44 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- ubuntu questing: libssh2-1-dev 1.11.1-1build1
- ubuntu questing: libssh2-1-dev 1.11.1-1ubuntu0.25.10.2
- ubuntu resolute: libssh2-1-dev 1.11.1-1build2 Β· BSD3
- ubuntu resolute: libssh2-1-dev 1.11.1-1ubuntu0.26.04.4 Β· BSD3
- ubuntu stonking: libssh2-1-dev 1.11.1-6 Β· BSD3
- π the page's license: BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms