libssh2_scp_send64(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_send64 β€” bestie edition πŸ’–

okay so this is a page from the libssh2 manual, section 3 (library functions, iykyk), and it's all about yeeting a whole file at a remote host over SCP. no cap, it's giving main character energy. let's get into it 🫢


✨ NAME ✨

libssh2_scp_send64 β€” Send a file via SCP

like. literally that's the whole vibe. send a file. via SCP. iconic πŸ’…


🌸 SYNOPSIS 🌸

#include <libssh2.h>

LIBSSH2_CHANNEL *
libssh2_scp_send64(LIBSSH2_SESSION *session, const char *path, int mode,
                   libssh2_uint64_t size, time_t mtime, time_t atime);

yes she takes six arguments, she's high maintenance and she deserves it πŸ’œ


πŸ¦‹ DESCRIPTION πŸ¦‹

  • session β€” the Session instance, aka the one you got back from libssh2_session_init_ex(3). your whole connection lives in there.
  • path β€” Full path and filename of the file you're transferring to. bestie, that's the remote file name. the one on the other side of the wire. don't get it twisted πŸ™ˆ
  • mode β€” File access mode to create the file with.
  • size β€” Size of the file being transmitted (Must be known ahead of time). and listen, this one's important: it needs to be passed in as variable type libssh2_uint64_t. That type is 64 bit on modern operating systems and compilers. she's thicc. she's built different. πŸ’ͺ
  • mtime β€” mtime to assign to the file being created.
  • atime β€” atime to assign to the file being created. (Set this and mtime to zero to instruct the remote host to use the current time. cute little shortcut, slay ⭐)

and that's it. that's the function. Send a file to the remote host via SCP. periodt. πŸ’–


πŸ‘‘ RETURN VALUE πŸ‘‘

Pointer to a newly allocated LIBSSH2_CHANNEL instance. or NULL on errors 😭

so like, check your pointers, bestie. always check your pointers.


πŸ’€ ERRORS πŸ’€

  • LIBSSH2_ERROR_ALLOC β€” An internal memory allocation call failed. the malloc girlies are crying.
  • LIBSSH2_ERROR_SOCKET_SEND β€” Unable to send data on socket. the socket said no πŸ™…
  • LIBSSH2_ERROR_SCP_PROTOCOL β€” (no extra detail given, she's mysterious like that πŸŽ€)
  • LIBSSH2_ERROR_EAGAIN β€” Marked for non-blocking I/O but the call would block. not an L, just a "come back later" πŸ’…

🌈 AVAILABILITY 🌈

This function was added in libssh2 1.2.6 and is meant to replace the former libssh2_scp_send_ex(3) function. out with the old, in with the new, glow-up complete ✨


πŸ”₯ SEE ALSO πŸ”₯

go read that one next, bestie, it's the whole prequel 🫢


lowkey reminder: size must be known ahead of time, and it must be libssh2_uint64_t. no guessing. the remote host is counting on you. πŸ™ˆ

okay that's the whole page, mwah πŸ’‹ this was libssh2 1.2.6, dated 17 Apr 2010 β€” yes she's vintage, she's a classic, she ate and left no crumbs πŸ‘‘βœ¨ bye bestie, go send some files πŸ’–πŸ¦‹πŸŒΈ