A Persistent Session is a FASP session that does not require any predefined source or destination before being initiated.  Instead, the source and destination paths are provided to the Persistent Session through FASP Management commands when it is started.  Persistent Sessions are useful when multiple files will be sent in a session and full control is needed for each file being transferred.  It can also be useful when the paths names length are too long for the Operating System's command line length.

Essentially, when ascp starts a session and has the --keepalive option, it accepts commands on the management port which allows you to perform specific tasks.  For example:

  • You can add a source to the session by specifying the source and destination
    • FASPMGR 2
    • Type: START
    • Source: [source_path]
    • Destination: [dest_path]
  • You can cancel a source that is being transferred in the session
    • FASPMGR 2
    • Type: STOP
    • Source [source_path] - as seen in the management STAT messages
  • You can immediately close a session and stop all active and pending transfers
    • FASPMGR 2
    • Type: DONE
    • Operation: SHUTDOWN (optional)
  • You can close a session with a delay, which will allow all the active and pending transfers to complete
    • FASPMGR 2
    • Type: DONE
    • Operation: LINGER

Persistent Sessions in FASP Manager SDK

The concept of Persistent Sessions has been available since version 2.6. To use it in your application you can set the following parameters and run the following methods.

You will need to set the persist flag to true in the xferParams, you can do this with the following line of code:

xferParams.persist = true

Now that you have the persist parameter set to true you can create a job order without defining any source or destination path. You will then need to implement a transfer listener in your code and submit a transfer job with this listener. You can accomplish this by adding the following to your code (depending on what language you are using).

//Javacom.asperasoft.faspmanager.TransferListener listener = ...
//C++Aspera::FaspManager::CallbackFunctor listener = ...
//.NET C#Aspera::Transfer::FileTransferListener listener = ...

Once the session is reported as being initiated the listen receives a TransferEvent (SESSION_START) in Java and C# or a CallBack Event (F_EVENT_SESSION_START) in C++ which indicates that the session is ready to accept sources. You can start individual file transfers within the session as needed for your application. Normally, the implementation of the listener is a good place for this process. You should also note that the destination path is not mandatory, since if one is not specified the file will be saved in the user's document root path; you should also note that the remote path must be relative to the user's document root path if defined for that user.For example you could:

  • Add all the sources/destinations pairs at once
  • Add sources/destinations pairs back to back (add a subsequent source when the current is reported as completed)
  • Add the sources/destinations pairs following any other protocol

Now that you have implemented your listeners and actions you should stop or lock the session when all the files are transferred

Video player