libssh2_scp_recv2(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

πŸ’– libssh2_scp_recv2 β€” bestie edition πŸ’–

okay so this one is a libssh2 manual page, and it's literally the glow-up version of grabbing a file off a remote host over SCP ✨


🌸 NAME 🌸

libssh2_scp_recv2 β€” request a remote file via SCP 🫢


✨ SYNOPSIS ✨

#include <libssh2.h>

LIBSSH2_CHANNEL *
libssh2_scp_recv2(LIBSSH2_SESSION *session, const char *path, struct_stat *sb);

πŸŽ€ DESCRIPTION πŸŽ€

no cap, this is the whole vibe right here. three things go in, one channel comes out πŸ‘‘

  • session β€” the Session instance, and you get it from libssh2_session_init_ex(3). yes, that exact one. it's giving "you already know her" πŸ’…
  • path β€” Full path and filename of file to transfer. That is the remote file name. so like, the whole journey to the file on the other machine, not yours πŸ¦‹
  • sb β€” Populated with remote file's size, mode, mtime, and atime. she gets filled in for you β€” size, mode, mtime, atime, the whole lil info dump πŸ“¦

and then the actual thing: Request a file from the remote host via SCP. that's it, that's the job, and she eats every time 😌


🌈 RETURN VALUE 🌈

you get back a Pointer to a newly allocated LIBSSH2_CHANNEL instance. fresh, brand new, main character energy πŸ‘‘

or NULL on errors. which is the sad path. we don't love the sad path 😭


πŸ’€ ERRORS πŸ’€

okay so when things go wrong, they go wrong in one of these specific ways:

  • LIBSSH2_ERROR_ALLOC β€” An internal memory allocation call failed. the malloc said no ma'am πŸ™ˆ
  • LIBSSH2_ERROR_SCP_PROTOCOL β€” no extra notes on this one, it's just... the protocol being protocol. shrug πŸ’€
  • LIBSSH2_ERROR_EAGAIN β€” Marked for non-blocking I/O but the call would block. so like, she's not gonna wait around for you β€” try again later, bestie 🫢

⭐ SEE ALSO ⭐

go read those too, iykyk πŸ“šβœ¨


and that's the page, bestie!! this one's from the libssh2 manual, version 1.6.1, dated 29 Jun 2015 β€” so she's a lil vintage but she still slays πŸ’–πŸŽ€πŸ¦‹