# Hasp.Transfer Method

Namespace: Aladdin.Hasp

## Description

Transfers a license from a Sentinel SL key to a recipient machine or revokes a license from a Sentinel SL key.

NOTE This method supersedes the Detach method.

## Syntax

    static HaspStatus Transfer ( String     action,
                                 String     scope,
                                 String     vendor_code,
                                 String     recipient,
                                 ref String info
                               )

## Parameters

`action` | `Rehost` | Specify rehost parameters, in XML format. The following example specifies that the SL key with Key ID 12321 should be transferred. `<rehost> <hasp id=”12321”/> </rehost>`
`Detach` | Specify parameters to detach a single license, in XML format. The following example specifies that a detached license for Product ID 12345 will expire after 604,800 seconds (one week): `<detach>` `<product id=”12345”>` `<duration>604800</duration>` `</product>` `</detach>` For details, see Detaching an SL AdminMode or SL UserMode License.
`Network_Detach` | Specify parameters to detach an SL Admin Mode license with concurrency, in XML format. The following example specifies that a license with 10 concurrent seats for Product ID 67876 will expire after 31,536,000 seconds (one year): `<network_detach>` `<product id=”67876”>` `<duration>31536000</duration>` `<seats>10</seats>` `</product>` `</network_detach>` For more information, see Detaching a License With Concurrency.
`Cancel_Detach` | Specify cancel detach or network detach parameters, in XML format. The following example specifies that the Sentinel SL key with Key ID “12321” for the detached license should be cancelled: `<cancel> <hasp id=”12321”/> </cancel>`
`Revoke` | Revoke operation parameters in XML format. The following example shows how to revoke a license for Product ID 12345: `<revoke> <product id=”12345”/></revoke>`
`scope` | For `Rehost` or `Cancel_Detach` | Search parameters for the container that is to be rehosted or canceled. For more information, see Scope Input XML Tags.
For `Detach, Network Detach or Revoke` | Search parameters for the Product that is to be detached or revoked. For more information, see Scope Input XML Tags.
`vendor_code` | Bytes that contain the Vendor Code
`recipient` | For `Detach, Network Detach or Rehost` | Definition in XML format of the recipient machine to which the transferred or detached license or seats will be attached. Use either the GetInfo or GetSessionInfo method, together with the HASP_RECIPIENT predefined format template, to retrieve the recipient information.
For `Cancel_Detach or Revoke` | Ignored (set to Null).
`info` | Reference of the string that receives the output (in XML format). This information is an: >H2H file (for the Rehost action) >H2R file (for the Detach action) >R2H file (for the Cancel_Detach action). If the detached Product is already expired, no buffer is returned. >C2V file (for the Revoke action). NOTE For the C2V file generated by the Revoke action, you do not need to call the Update function. To complete the operation(except for the Revoke action), the file should be installed on the target machine using the Update method (or using the Admin Control Center or RUS utility).

## Return Values

A HaspStatus status code.

## Usage Notes

The Transfer method performs one of the following functions:

>Removes a Sentinel SL key from its host machine and prepares it to be transferred ("rehosted") to a target machine. The protection key must be defined with rehosting allowed.

>Detaches a license for a Product from a Sentinel SL key (on the host machine), according to customizable parameters. Features defined as detachable and memory files that belong to the Product are detached. You can detach either an SL AdminMode license or an SL UserMode license as described below.

A license can be detached using:

•On-demand detach. You can perform an on-demand detach by calling the Transfer method.

•Automatic detach. Automatic detach occurs when the Login or LoginScope method is called.

For details, see Sentinel Admin Control Center help.

>Cancels a detached license from the Sentinel SL key (on the recipient machine), typically before the detached license was due to expire.

>Revoke a license for a Product.

You do not need to be logged in to a Feature or Sentinel protection key in order to use this method.

The required Vendor Codes are stored in a VendorCodes folder in your system. Without the correct Vendor Code, the method call cannot succeed.

### Detaching an SL AdminMode or SL UserMode License

When you call the Transfer method specifying the detach action, the method detaches one of the following by default:

>SL AdminMode license (if Sentinel Run-time Environment is installed on the recipient machine)

>SL UserMode license (if Sentinel Run-time Environment is not installed on the recipient machine)

For Sentinel EMS: When detaching a license for user-based licensing, an SL UserMode license is required. If Sentinel Run-time Environment (RTE) is installed on the recipient machine, you must force the detach operation to detach an SL UserMode license.

To force the detach of an SL UserMode license when the RTE is installed on the recipient machine:

1.Call GetInfo or GetSessionInfo to obtain the recipient string.

2.Include only the SL UserMode license manager information from the recipient string.

For example: In the following output from GetInfo, exclude the marked SL-AdminMode information from the recipient string that is passed to the Transfer method.

## Overloaded Method

The following overloaded method is provided. It differs from the method above only in the arguments that it accepts.

    static HaspStatus Transfer ( String     action,
                                 String     scope,
                                 byte[]     vendor_code,
                                 String     recipient,
                                 ref String info
                                )

## Related Topics

Detaching a License With Concurrency

GetInfo Method

GetSessionInfo Method

Scope Input XML Tags

Format XML Tags

hasp_transfer XML Tags

XML Tags for the Transfer Method