Back to product page

Blocking function


Determines whether methods are blocking.

Type

A Long value. If successful, 0 is returned, otherwise error as specified here

Syntax

  • C
long Sftp_GetBlocking(void *Sftp, int *pVal);
long Sftp_SetBlocking(void *Sftp, int *newVal);
The Blocking(void *Sftp,Part Description void *Sftp Handle of the created Sftp instance. int *pVal, newVal ) syntax has these parts:
void *SftpHandle of the created Sftp instance.
Part Description void *Sftp Handle of the created Sftp instance. int *pVal, newVal Integer, when set to a nonzero value forces wodSFTP to the execute function in with blocking - causing your code to wait until the function completes.

Remarks

Blocking mode is ideal for scripting environments where you cannot use asynchronous connections. Although callbacks are still invoked, you can ignore them and check whether an error occurred during the method's execution.

The difference between blocking and non-blocking operation can be illustrated using the Connect function.

If Blocking is set to True, wodSFTP will wait while it connects to the remote server. Once connected, control will be returned to your code and you can continue with execution. If an error is generated, control will be returned immediately.

If Blocking is set to False, wodSFTP will return immediately when Connect is called, regardless of whether it managed to connect to the remote server or not at that moment in time. Following a non-blocking call to Connect, you should wait for the Connected callback to be invoked to determine whether the connection was successful or not.

The above applies also to all methods used in wodSFTP (such as ListDir, MakeDir etc). If an error occurs, it will be returned when the method finishes.

Platforms

Windows