wodSFTP API library - StateChange Callback
    
 

Description

Called when wodSFTP changes its state.


Syntax

void (*StateChange)(void *Sftp, long OldState);

The StateChange callback syntax has these parts:

Part Description
void *Sftp Handle of the created Sftp instance.
long OldState A StatesEnum enumeration, as described in settings. Holds the previous state.

Settings

The settings for OldState are:

Constant Value Description
 Disconnected 0 Disconnected from server.
 Connecting 1 Connecting to server.
 LogonInProgress 2 Sending authentication data.
 Connected 3 Connected to server - idle.
 Receiving 4 Receiving data from server.
 Sending 5 Sending data to server.
 Executing 6 Executing command on server.

Remarks

The StateChange callback is invoked each time wodSFTP's internal state changes. Initially, it is set to Disconnected. Once you initiate a new connection, it will change to Connecting, etc..

Using this callback you can see if there is something happening with wodSFTP or if it is idle and waiting for your commands.

You can determine the current state using State function.

NOTE: this callback is called only if you have created instance of SftpEventsStruct structure, and set up its StateChange member to function implementing it.