Scp Unicode C Reference Documentation

Scp

Current Version: 11.5.0

Chilkat.Scp

Transfer files, text, and binary data over SCP using an existing SSH connection.

Chilkat.Scp is the Chilkat class for SCP file transfer over an already-established Chilkat.Ssh connection. It supports local-file upload and download, in-memory binary transfer, encoded binary transfer, text transfer with explicit character sets, BinData transfer, directory-tree synchronization, sync filtering, remote UNIX permission overrides, environment variables, progress scaling, abort support, and asynchronous task integration.

Uses an SSH connection

Attach Scp to an authenticated Chilkat.Ssh session rather than opening a separate network connection.

Upload and download files

Transfer local files to remote paths or download remote files to the local filesystem using SCP.

Memory-based transfers

Upload or download binary data, encoded data, text, or Chilkat.BinData without requiring temporary files.

Directory synchronization

Synchronize directory trees and use filtering options to include or exclude selected files.

Remote file options

Set remote UNIX permissions, pass environment variables, and control transfer-related behavior required by the remote server.

Progress and async support

Monitor progress, scale progress percentages, abort active transfers, and run supported operations as asynchronous tasks.

Common pattern: Connect and authenticate with Chilkat.Ssh, initialize Chilkat.Scp with that SSH connection, then upload, download, or synchronize the desired files or in-memory data. Use Scp for SCP-style transfers over SSH; use Chilkat.SFtp when the remote server expects the SFTP protocol instead.

Create/Dispose

HCkScpW instance = CkScpW_Create();
// ...
CkScpW_Dispose(instance);
HCkScpW CkScpW_Create(void);

Creates an instance of the HCkScpW object and returns a handle ("void *" pointer). The handle is passed in the 1st argument for the functions listed on this page.

void CkScpW_Dispose(HCkScpW handle);

Objects created by calling CkScpW_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function. Also, any handle returned by a Chilkat "C" function must also be freed by the application by calling the appropriate Dispose method, such as CkScpW_Dispose.

Callback Functions

Callback Functions introduced in Chilkat v9.5.0.56
void CkScpW_setAbortCheck(HCkScpW cHandle, BOOL (*fnAbortCheck)(void));

Provides the opportunity for a method call to be aborted. If TRUE is returned, the operation in progress is aborted. Return FALSE to allow the current method call to continue. This callback function is called periodically based on the value of the HeartbeatMs property. (If HeartbeatMs is 0, then no callbacks are made.) As an example, to make 5 AbortCheck callbacks per second, set the HeartbeatMs property equal to 200.

void CkScpW_setPercentDone(HCkScpW cHandle, BOOL (*fnPercentDone)(int pctDone));

Provides the percentage completed for any method that involves network communications or time-consuming processing (assuming it is a method where a percentage completion can be measured). This callback is only called when it is possible to know a percentage completion, and when it makes sense to express the operation as a percentage completed. The pctDone argument will have a value from 1 to 100. For methods that complete very quickly, the number of PercentDone callbacks will vary, but the final callback should have a value of 100. For long running operations, no more than one callback per percentage point will occur (for example: 1, 2, 3, ... 98, 99, 100).

This callback counts as an AbortCheck callback, and takes the place of the AbortCheck event when it fires.

The return value indicates whether the method call should be aborted, or whether it should proceed. Return TRUE to abort, and FALSE to proceed.

void CkScpW_setProgressInfo(HCkScpW cHandle, void (*fnProgressInfo)(const wchar_t *name, const wchar_t *value));

This is a general callback that provides name/value information about what is happening at certain points during a method call. To see the information provided in ProgressInfo callbacks, if any, write code to handle this event and log the name/value pairs. Most are self-explanatory.

void CkScpW_setTaskCompleted(HCkScpW cHandle, void (*fnTaskCompleted)(HCkTaskW hTask));

Called in the background thread when an asynchronous task completes. (Note: When an async method is running, all callbacks are in the background thread.)

Properties

AbortCurrent
BOOL CkScpW_getAbortCurrent(HCkScpW cHandle);
void CkScpW_putAbortCurrent(HCkScpW cHandle, BOOL newVal);
Introduced in version 9.5.0.58

Set to TRUE to request cancellation of the method currently executing on this object. Long-running network and file-transfer operations check this property periodically; a method that completes quickly may finish before the request is observed.

Both synchronous and asynchronous operations can be cancelled. To cancel a synchronous call, set this property from another thread on the same Scp object. Chilkat resets the property to FALSE after the cancellation is processed. If no method is running, a previously set value is cleared when the next method begins.

Cooperative cancellation: This property requests an abort; it does not forcibly terminate a thread. Use the method return value, LastMethodSuccess where applicable, and LastErrorText to determine the final outcome.

top
DebugLogFilePath
void CkScpW_getDebugLogFilePath(HCkScpW cHandle, HCkString retval);
void CkScpW_putDebugLogFilePath(HCkScpW cHandle, const wchar_t *newVal);
const wchar_t *CkScpW_debugLogFilePath(HCkScpW cHandle);

If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. This logging helps identify the context and history of Chilkat calls leading up to any crash or hang, aiding in debugging.

Enabling the VerboseLogging property provides more detailed information. This property is mainly used for debugging rare instances where a Chilkat method call causes a hang or crash, which should generally not happen.

Possible causes of hangs include:

  • A timeout property set to 0, indicating an infinite timeout.
  • A hang occurring within an event callback in the application code.
  • An internal bug in the Chilkat code causing the hang.

More Information and Examples
top
HeartbeatMs
int CkScpW_getHeartbeatMs(HCkScpW cHandle);
void CkScpW_putHeartbeatMs(HCkScpW cHandle, int newVal);

Specifies the interval, in milliseconds, between AbortCheck event callbacks during supported long-running operations. The callback allows the application to report activity or request cancellation before the operation completes.

The default value is 0, which disables periodic AbortCheck callbacks.

Event-callback setting: This property is useful only in programming environments that support Chilkat event callbacks. It is not an SSH keep-alive interval and does not change connection or read timeouts.

More Information and Examples
top
LastErrorHtml
void CkScpW_getLastErrorHtml(HCkScpW cHandle, HCkString retval);
const wchar_t *CkScpW_lastErrorHtml(HCkScpW cHandle);

Provides HTML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.

top
LastErrorText
void CkScpW_getLastErrorText(HCkScpW cHandle, HCkString retval);
const wchar_t *CkScpW_lastErrorText(HCkScpW cHandle);

Provides plain text information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.

top
LastErrorXml
void CkScpW_getLastErrorXml(HCkScpW cHandle, HCkString retval);
const wchar_t *CkScpW_lastErrorXml(HCkScpW cHandle);

Provides XML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.

top
LastMethodSuccess
BOOL CkScpW_getLastMethodSuccess(HCkScpW cHandle);
void CkScpW_putLastMethodSuccess(HCkScpW cHandle, BOOL newVal);

Indicates the success or failure of the most recent method call: TRUE means success, FALSE means failure. This property remains unchanged by property setters or getters. This method is present to address challenges in checking for null or Nothing returns in certain programming languages. Note: This property does not apply to methods that return integer values or to boolean-returning methods where the boolean does not indicate success or failure.

top
PercentDoneScale
int CkScpW_getPercentDoneScale(HCkScpW cHandle);
void CkScpW_putPercentDoneScale(HCkScpW cHandle, int newVal);
Introduced in version 9.5.0.51

Specifies the value that represents 100% completion in PercentDone event callbacks. The default is 100, which reports progress in whole-percent units. For example, when the scale is 1000, a callback value of 453 represents 45.3% completion.

The value is limited to the range 10 through 100000. Increasing the scale provides finer numeric granularity for operations whose progress can be measured.

Event-callback setting: This property applies only in programming environments that support Chilkat event callbacks. A larger scale changes the meaning and possible granularity of callback values; it does not guarantee that every intermediate value will be reported.

top
SendEnv
void CkScpW_getSendEnv(HCkScpW cHandle, HCkString retval);
void CkScpW_putSendEnv(HCkScpW cHandle, const wchar_t *newVal);
const wchar_t *CkScpW_sendEnv(HCkScpW cHandle);
Introduced in version 9.5.0.79

Specifies environment variables to send for each SCP upload or download. Set the property to a JSON object whose member names are environment-variable names and whose values are strings.

{
  "LCS_PASSWORD": "myPassword",
  "SOME_ENV_VAR": "some_value"
}
Server policy controls acceptance: SCP transfers run through SSH channels. The SSH server may accept, reject, or ignore requested environment variables according to its configuration. Do not assume that setting this property guarantees that the remote SCP process receives every variable.
Sensitive values: Environment variables can contain secrets, but they are not a substitute for SSH authentication. Avoid exposing sensitive values in application logs or diagnostic output.

top
SyncedFiles
void CkScpW_getSyncedFiles(HCkScpW cHandle, HCkString retval);
void CkScpW_putSyncedFiles(HCkScpW cHandle, const wchar_t *newVal);
const wchar_t *CkScpW_syncedFiles(HCkScpW cHandle);
Introduced in version 9.5.0.51

Contains the local paths of the files transferred by the most recent call to SyncTreeUpload or SyncTreeDownload. Paths are listed one per line.

  • After an upload, each line is the full local path of a source file that was uploaded.
  • After a download, each line is the full local path of a destination file that was downloaded.
Local paths only: This property reports local filesystem paths, not remote paths. It lists files actually transferred by the last synchronization operation, rather than every file examined during comparison.

More Information and Examples
top
SyncMustMatch
void CkScpW_getSyncMustMatch(HCkScpW cHandle, HCkString retval);
void CkScpW_putSyncMustMatch(HCkScpW cHandle, const wchar_t *newVal);
const wchar_t *CkScpW_syncMustMatch(HCkScpW cHandle);
Introduced in version 9.5.0.51

Specifies a semicolon-separated list of wildcard patterns for filenames that are eligible for transfer by SyncTreeUpload and SyncTreeDownload. A file is considered only when its filename matches at least one pattern.

For example, *.xml;*.txt;*.csv limits synchronization to XML, text, and CSV files. The default empty string imposes no include restriction.

Pattern scope: Patterns are matched against the final filename, not the full local or remote path. Directory traversal is controlled separately by SyncMustMatchDir and SyncMustNotMatchDir.

top
SyncMustMatchDir
void CkScpW_getSyncMustMatchDir(HCkScpW cHandle, HCkString retval);
void CkScpW_putSyncMustMatchDir(HCkScpW cHandle, const wchar_t *newVal);
const wchar_t *CkScpW_syncMustMatchDir(HCkScpW cHandle);
Introduced in version 9.5.0.58

Specifies a semicolon-separated list of wildcard patterns for directory names that may be traversed by SyncTreeUpload and SyncTreeDownload. When this property is nonempty, synchronization descends only into directories whose names match at least one pattern.

For example, a*;b*;c* permits traversal into directories whose names begin with a, b, or c. The default empty string permits traversal into all directories, subject to SyncMustNotMatchDir.

Pattern scope: Each pattern is matched against the directory name itself, not its complete path. This property affects traversal; it does not directly select individual files.

top
SyncMustNotMatch
void CkScpW_getSyncMustNotMatch(HCkScpW cHandle, HCkString retval);
void CkScpW_putSyncMustNotMatch(HCkScpW cHandle, const wchar_t *newVal);
const wchar_t *CkScpW_syncMustNotMatch(HCkScpW cHandle);
Introduced in version 9.5.0.51

Specifies a semicolon-separated list of wildcard patterns for filenames that must be skipped by SyncTreeUpload and SyncTreeDownload.

For example, *.tmp;*.bak;*.log excludes temporary, backup, and log files. The default empty string excludes no files.

Pattern scope: Patterns are matched against the final filename, not the full path. Use SyncMustNotMatchDir to prevent synchronization from entering selected directories and their subtrees.

More Information and Examples
top
SyncMustNotMatchDir
void CkScpW_getSyncMustNotMatchDir(HCkScpW cHandle, HCkString retval);
void CkScpW_putSyncMustNotMatchDir(HCkScpW cHandle, const wchar_t *newVal);
const wchar_t *CkScpW_syncMustNotMatchDir(HCkScpW cHandle);
Introduced in version 9.5.0.58

Specifies a semicolon-separated list of wildcard patterns for directory names that must not be traversed by SyncTreeUpload and SyncTreeDownload. A matching directory and everything below it are skipped.

For example, temp*;cache*;.git prevents traversal into temporary, cache, and Git metadata directories. The default empty string excludes no directories.

Pattern scope: Each pattern is matched against the directory name itself, not its complete path. This setting is especially useful during recursive synchronization because excluding a directory avoids scanning its entire subtree.

top
UncommonOptions
void CkScpW_getUncommonOptions(HCkScpW cHandle, HCkString retval);
void CkScpW_putUncommonOptions(HCkScpW cHandle, const wchar_t *newVal);
const wchar_t *CkScpW_uncommonOptions(HCkScpW cHandle);
Introduced in version 9.5.0.77

Provides a comma-separated list of specialized compatibility options. The default is the empty string, which is appropriate for normal SCP transfers.

KeywordBehavior
FilenameOnlyUses only the filename, rather than the complete target path, in the remote scp -t command. This option exists for compatibility with systems such as certain LANCOM routers.
ProtectFromVpnOn Android, attempts to route the SCP connection outside an installed or active VPN.
Leave empty unless needed: These options alter uncommon platform or server compatibility behavior. Enable a keyword only when a Chilkat example, release note, or support response identifies it as necessary for the target environment.

top
UnixPermOverride
void CkScpW_getUnixPermOverride(HCkScpW cHandle, HCkString retval);
void CkScpW_putUnixPermOverride(HCkScpW cHandle, const wchar_t *newVal);
const wchar_t *CkScpW_unixPermOverride(HCkScpW cHandle);
Introduced in version 9.5.0.77

Specifies an octal UNIX permission mode to apply to files uploaded by SCP, overriding the permissions derived from the local source file. For example, set this property to 0644 to grant read/write permission to the owner and read-only permission to the group and others.

The default is the empty string, which causes the uploaded file's remote permissions to be based on the local file's permissions.

UNIX permission notation: Supply the mode as a string containing octal digits, such as 0600, 0644, or 0755. The remote SSH account must still have permission to create or replace the file, and server-side policy may restrict the final mode.

top
VerboseLogging
BOOL CkScpW_getVerboseLogging(HCkScpW cHandle);
void CkScpW_putVerboseLogging(HCkScpW cHandle, BOOL newVal);

If set to TRUE, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is FALSE. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.

top
Version
void CkScpW_getVersion(HCkScpW cHandle, HCkString retval);
const wchar_t *CkScpW_version(HCkScpW cHandle);

Version of the component/library, such as "10.1.0"

More Information and Examples
top

Methods

DownloadBd
BOOL CkScpW_DownloadBd(HCkScpW cHandle, const wchar_t *remotePath, HCkBinDataW bd);
Introduced in version 9.5.0.77

Downloads the file at remotePath and appends its exact bytes to the existing contents of the BinData object in bd.

An absolute remote path begins with /. A relative path is interpreted relative to the authenticated SSH user's home directory.

Append behavior: This method does not clear bd before downloading. Clear the BinData object first when the downloaded file should replace, rather than follow, its current contents.

Returns TRUE for success, FALSE for failure.

top
DownloadBdAsync (1)
HCkTaskW CkScpW_DownloadBdAsync(HCkScpW cHandle, const wchar_t *remotePath, HCkBinDataW bd);
Introduced in version 9.5.0.77

Creates an asynchronous task to call the DownloadBd method with the arguments provided.

Returns NULL on failure

top
DownloadBinaryEncoded
BOOL CkScpW_DownloadBinaryEncoded(HCkScpW cHandle, const wchar_t *remotePath, const wchar_t *encoding, const wchar_t *outStr);
const wchar_t *CkScpW_downloadBinaryEncoded(HCkScpW cHandle, const wchar_t *remotePath, const wchar_t *encoding);
Introduced in version 9.5.0.51

Downloads the file at remotePath and returns its bytes encoded as text using the binary encoding named by encoding, such as base64 or hex.

An absolute remote path begins with /. A relative path is interpreted relative to the authenticated SSH user's home directory.

Binary encoding versus charset: encoding selects a text representation of arbitrary bytes; it is not a character set and does not decode the remote file as text. Use DownloadString when the remote file contains text that must be decoded with a charset.
Memory use: The complete file and its encoded representation are held in memory. Encodings such as Base64 also increase the amount of data returned.

Returns TRUE for success, FALSE for failure.

top
DownloadBinaryEncodedAsync (1)
HCkTaskW CkScpW_DownloadBinaryEncodedAsync(HCkScpW cHandle, const wchar_t *remotePath, const wchar_t *encoding);
Introduced in version 9.5.0.51

Creates an asynchronous task to call the DownloadBinaryEncoded method with the arguments provided.

Returns NULL on failure

top
DownloadFile
BOOL CkScpW_DownloadFile(HCkScpW cHandle, const wchar_t *remotePath, const wchar_t *localPath);
Introduced in version 9.5.0.51

Downloads the file at remotePath from the SSH server and writes its bytes to the local filesystem path in localPath.

An absolute remote path begins with /. A relative remote path is interpreted relative to the authenticated SSH user's home directory. The application must have permission to create or replace the local destination file.

Streaming transfer: This method is the preferred download method for large files because the data is written to disk rather than returned as one in-memory byte array or string.

Returns TRUE for success, FALSE for failure.

top
DownloadFileAsync (1)
HCkTaskW CkScpW_DownloadFileAsync(HCkScpW cHandle, const wchar_t *remotePath, const wchar_t *localPath);
Introduced in version 9.5.0.51

Creates an asynchronous task to call the DownloadFile method with the arguments provided.

Returns NULL on failure

top
DownloadString
BOOL CkScpW_DownloadString(HCkScpW cHandle, const wchar_t *remotePath, const wchar_t *charset, const wchar_t *outStr);
const wchar_t *CkScpW_downloadString(HCkScpW cHandle, const wchar_t *remotePath, const wchar_t *charset);
Introduced in version 9.5.0.51

Downloads the file at remotePath, decodes its bytes using the character encoding named by charset, and returns the resulting text.

An absolute remote path begins with /. A relative path is interpreted relative to the authenticated SSH user's home directory.

Charset matters: charset describes how the remote file’s bytes represent characters, for example utf-8, windows-1252, or iso-8859-1. Using the wrong charset can produce incorrect characters. Use a binary download method for files that are not text.

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
DownloadStringAsync (1)
HCkTaskW CkScpW_DownloadStringAsync(HCkScpW cHandle, const wchar_t *remotePath, const wchar_t *charset);
Introduced in version 9.5.0.51

Creates an asynchronous task to call the DownloadString method with the arguments provided.

Returns NULL on failure

top
LoadTaskCaller
BOOL CkScpW_LoadTaskCaller(HCkScpW cHandle, HCkTaskW task);
Introduced in version 9.5.0.80

Loads the original caller object associated with the asynchronous Task in task. task must be a task created by a compatible asynchronous method of this class.

Normally not application-facing: This is a support method for Chilkat async-task infrastructure and generated language wrappers. It does not load arbitrary task results or transfer data.

Returns TRUE for success, FALSE for failure.

top
SyncTreeDownload
BOOL CkScpW_SyncTreeDownload(HCkScpW cHandle, const wchar_t *remoteRoot, const wchar_t *localRoot, int mode, BOOL bRecurse);
Introduced in version 9.5.0.51

Synchronizes files from the remote directory tree rooted at remoteRoot to the local directory rooted at localRoot. bRecurse controls recursion: set it to TRUE to descend into subdirectories, or FALSE to process only files directly in the root directory.

An absolute remote root begins with /; a relative remote root is interpreted relative to the authenticated SSH user's home directory. A relative local root is interpreted relative to the application's current working directory.

ModeFiles transferred
0Download every eligible file.
1Download files that do not already exist locally.
2Download files that are missing locally or whose remote last-modified time is newer than the local file.
3Download only files whose remote last-modified time is newer. A remote file that has no local counterpart is not downloaded.
5Download files that are missing locally or whose size differs from the local file.
6Download files that are missing locally, differ in size, or have a newer remote last-modified time.

The filename and directory filters in SyncMustMatch, SyncMustNotMatch, SyncMustMatchDir, and SyncMustNotMatchDir are applied during traversal. After completion, SyncedFiles lists the full local paths of files actually downloaded.

Timestamp-based modes: Modes 2, 3, and 6 compare last-modified times. Incorrect server timestamps or clock differences between systems can affect which file is considered newer.

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
SyncTreeDownloadAsync (1)
HCkTaskW CkScpW_SyncTreeDownloadAsync(HCkScpW cHandle, const wchar_t *remoteRoot, const wchar_t *localRoot, int mode, BOOL bRecurse);
Introduced in version 9.5.0.51

Creates an asynchronous task to call the SyncTreeDownload method with the arguments provided.

Returns NULL on failure

top
SyncTreeUpload
BOOL CkScpW_SyncTreeUpload(HCkScpW cHandle, const wchar_t *localBaseDir, const wchar_t *remoteBaseDir, int mode, BOOL bRecurse);
Introduced in version 9.5.0.51

Synchronizes files from the local directory tree rooted at localBaseDir to the remote directory rooted at remoteBaseDir. bRecurse controls recursion: set it to TRUE to descend into subdirectories, or FALSE to process only files directly in the local base directory.

A relative local base directory is interpreted relative to the application's current working directory. An absolute remote base directory begins with /; a relative remote base directory is interpreted relative to the authenticated SSH user's home directory.

ModeFiles transferred
0Upload every eligible file.
1Upload files that do not already exist on the remote server.
2Upload files that are missing remotely or whose local last-modified time is newer than the remote file.
3Upload only files whose local last-modified time is newer. A local file that has no remote counterpart is not uploaded.
4Upload files that are missing remotely or whose size differs from the remote file.
5Upload files that are missing remotely, differ in size, or have a newer local last-modified time.

The filename and directory filters in SyncMustMatch, SyncMustNotMatch, SyncMustMatchDir, and SyncMustNotMatchDir are applied during traversal. After completion, SyncedFiles lists the full local paths of files actually uploaded.

Timestamp-based modes: Modes 2, 3, and 5 compare last-modified times. Incorrect server timestamps or clock differences between systems can affect which file is considered newer.

Returns TRUE for success, FALSE for failure.

top
SyncTreeUploadAsync (1)
HCkTaskW CkScpW_SyncTreeUploadAsync(HCkScpW cHandle, const wchar_t *localBaseDir, const wchar_t *remoteBaseDir, int mode, BOOL bRecurse);
Introduced in version 9.5.0.51

Creates an asynchronous task to call the SyncTreeUpload method with the arguments provided.

Returns NULL on failure

top
UploadBd
BOOL CkScpW_UploadBd(HCkScpW cHandle, const wchar_t *remotePath, HCkBinDataW bd);
Introduced in version 9.5.0.77

Uploads all bytes currently contained in the BinData object in bd to the remote file at remotePath. The data is transferred without character decoding or other transformation.

An absolute remote path begins with /. A relative path is interpreted relative to the authenticated SSH user's home directory. The remote parent directory must already exist.

Source object: The upload reads the current contents of bd and does not remove or modify those bytes.

Returns TRUE for success, FALSE for failure.

top
UploadBdAsync (1)
HCkTaskW CkScpW_UploadBdAsync(HCkScpW cHandle, const wchar_t *remotePath, HCkBinDataW bd);
Introduced in version 9.5.0.77

Creates an asynchronous task to call the UploadBd method with the arguments provided.

Returns NULL on failure

top
UploadBinaryEncoded
BOOL CkScpW_UploadBinaryEncoded(HCkScpW cHandle, const wchar_t *remotePath, const wchar_t *encodedData, const wchar_t *encoding);
Introduced in version 9.5.0.51

Decodes the text in encodedData using the binary encoding named by encoding, then uploads the resulting bytes to the remote file at remotePath. Typical encoding names include base64 and hex.

An absolute remote path begins with /. A relative path is interpreted relative to the authenticated SSH user's home directory. The remote parent directory must already exist.

The encoded text is not uploaded literally: For example, when encoding is base64, Chilkat Base64-decodes encodedData and transfers the decoded binary bytes. This method is for encoded binary representations, not character-set conversion.

Returns TRUE for success, FALSE for failure.

top
UploadBinaryEncodedAsync (1)
HCkTaskW CkScpW_UploadBinaryEncodedAsync(HCkScpW cHandle, const wchar_t *remotePath, const wchar_t *encodedData, const wchar_t *encoding);
Introduced in version 9.5.0.51

Creates an asynchronous task to call the UploadBinaryEncoded method with the arguments provided.

Returns NULL on failure

top
UploadFile
BOOL CkScpW_UploadFile(HCkScpW cHandle, const wchar_t *localPath, const wchar_t *remotePath);
Introduced in version 9.5.0.51

Uploads the local filesystem file at localPath to the remote path in remotePath. The file is transferred as raw bytes.

An absolute remote path begins with /. A relative remote path is interpreted relative to the authenticated SSH user's home directory. The remote parent directory must already exist, and the SSH account must have permission to create or replace the destination file.

Remote permissions are normally derived from the local file. Set UnixPermOverride when a specific remote UNIX mode is required.

SCP is not FTP: There is no ASCII or binary transfer mode. UploadFile copies the file bytes without line-ending or character-set conversion.

Returns TRUE for success, FALSE for failure.

top
UploadFileAsync (1)
HCkTaskW CkScpW_UploadFileAsync(HCkScpW cHandle, const wchar_t *localPath, const wchar_t *remotePath);
Introduced in version 9.5.0.51

Creates an asynchronous task to call the UploadFile method with the arguments provided.

Returns NULL on failure

top
UploadString
BOOL CkScpW_UploadString(HCkScpW cHandle, const wchar_t *remotePath, const wchar_t *textData, const wchar_t *charset);
Introduced in version 9.5.0.51

Encodes the text in textData using the character encoding named by charset, then uploads the resulting bytes to the remote file at remotePath.

An absolute remote path begins with /. A relative path is interpreted relative to the authenticated SSH user's home directory. The remote parent directory must already exist.

Text encoding: charset controls how characters are converted to bytes, for example utf-8, windows-1252, or iso-8859-1. SCP itself has no text mode; any line-ending characters already present in textData are encoded and transferred as part of the text.

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
UploadStringAsync (1)
HCkTaskW CkScpW_UploadStringAsync(HCkScpW cHandle, const wchar_t *remotePath, const wchar_t *textData, const wchar_t *charset);
Introduced in version 9.5.0.51

Creates an asynchronous task to call the UploadString method with the arguments provided.

Returns NULL on failure

top
UseSsh
BOOL CkScpW_UseSsh(HCkScpW cHandle, HCkSshW sshConnection);
Introduced in version 9.5.0.51

Associates this Scp object with the connected and authenticated Ssh object in sshConnection. Subsequent SCP operations use that existing SSH session rather than opening a separate network connection.

Connection, proxy, timeout, host-key verification, algorithm, logging, and other transport-related settings belong to the Ssh object and therefore apply to the SCP operations performed through it. Keep the SSH object connected and available for as long as the Scp object is using it.

SCP and SFTP are different protocols: Scp performs SCP-style transfers over SSH and requires compatible SCP support on the remote system. Use Chilkat.SFtp when the server expects the SSH File Transfer Protocol subsystem or when directory listing and remote file-management features are needed.

Returns TRUE for success, FALSE for failure.

top

Deprecated

DownloadBinary Deprecated
BOOL CkScpW_DownloadBinary(HCkScpW cHandle, const wchar_t *remotePath, const unsigned char * outBytes);
Introduced in version 9.5.0.51

Downloads the file at remotePath from the SSH server and returns its exact bytes. No character decoding or text transformation is performed.

An absolute remote path begins with /. A relative path is interpreted relative to the authenticated SSH user's home directory.

In-memory download: The complete file is returned in memory. For large files, DownloadFile is generally preferable because it writes directly to the local filesystem.

Returns TRUE for success, FALSE for failure.

top
DownloadBinaryAsync Deprecated (1)
HCkTaskW CkScpW_DownloadBinaryAsync(HCkScpW cHandle, const wchar_t *remotePath);
Introduced in version 9.5.0.51

Creates an asynchronous task to call the DownloadBinary method with the arguments provided.

Returns NULL on failure

top
UploadBinary Deprecated
BOOL CkScpW_UploadBinary(HCkScpW cHandle, const wchar_t *remotePath, HCkByteData binData);
Introduced in version 9.5.0.51

Uploads the exact bytes in binData to the remote file at remotePath. No text encoding, newline conversion, or other data transformation is performed.

An absolute remote path begins with /. A relative path is interpreted relative to the authenticated SSH user's home directory. The remote parent directory must already exist and the SSH account must have permission to create or replace the file.

Binary-safe transfer: Use this method for arbitrary in-memory data. For a local file, UploadFile avoids loading the entire source into an application byte array.

Returns TRUE for success, FALSE for failure.

top
UploadBinaryAsync Deprecated (1)
HCkTaskW CkScpW_UploadBinaryAsync(HCkScpW cHandle, const wchar_t *remotePath, HCkByteData binData);
Introduced in version 9.5.0.51

Creates an asynchronous task to call the UploadBinary method with the arguments provided.

Returns NULL on failure

top