libssh2_channel_forward_cancel(3)
π libssh2_channel_forward_cancel β bestie edition π
okay so you're deep in the libssh2 manual, page libssh2_channel_forward_cancel(3), and honestly? this one is a whole mood. it's the closing move. the "we're done here, thank u next" of TCP port forwarding. let's get into it π«Ά
β¨ NAME β¨
libssh2_channel_forward_cancel β cancel a forwarded TCP port π
like, you opened a port, and now you're closing it. main character exits the room.
πΈ SYNOPSIS πΈ
#include <libssh2.h>
int
libssh2_channel_forward_cancel(LIBSSH2_LISTENER *listener);
π¦ DESCRIPTION π¦
listenerβ your forwarding listener instance, as returned bylibssh2_channel_forward_listen_ex(3). that's the little guy you got back when you started all this. keep it safe, you need it now. π
so what does this function actually do? it tells the remote host to stop listening for new connections on a host/port you previously requested. that's it. that's the whole vibe. no cap.
likeβ¦ you asked the remote side to hold a door open for you, and this function is you going "okay bestie, you can let go of the door now, we're good." the door closes. the port is freed. iconic behaviour, honestly. π
π RETURN VALUE π
- returns
0on success β slay β¨ - returns a negative value on failure β not slay π
- returns
LIBSSH2_ERROR_EAGAINwhen it would otherwise block.
and here's the important lil caveat bestie, don't skip this one: while LIBSSH2_ERROR_EAGAIN is a negative number, it is not really a failure per se. it's just the function saying "not right now, try again later." do not panic. do not spiral. it's giving "hold on a sec" not "everything is on fire." π
π₯ ERRORS π₯
LIBSSH2_ERROR_ALLOCβ an internal memory allocation call failed. the computer ran out of room to think. πLIBSSH2_ERROR_SOCKET_SENDβ unable to send data on socket. the message could not go out. rip. π
π SEE ALSO π
libssh2_channel_forward_listen_ex(3)β the one that started it all, the origin story, the prequel. you literally cannot cancel a port you never opened, so go read that one too. iykyk π
and that's the whole page, no notes, ate and left no crumbs. this little gem lives in the libssh2 0.15 manual, dated 1 Jun 2007 β yes, it's been serving this exact energy since 2007, a true timeless queen π β and it was brought to you by the fine folks behind libssh2. mwah, bye bestie! π ππ¦
π¦ 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