Send File API
This API issues the Send File or the Resend File.
Syntax
INT __stdcall utlsend( LPCSTR lpszFileID , LPCSTR lpszHostName , BOOL bResend , SHORT nPriority , BOOL bSync , INT nWait , LPCSTR lpszFileName , LPCSTR lpszGroup , BOOL bNp );
Explanation of the parameters
- LPCSTR lpszFileID (IN)
-
Specify the file ID of the file for which to carry out the Send File
Specify the file ID as a character string within 50 bytes. To omit this parameter, specify 'NULL.'
- LPCSTR lpszHostName (IN)
-
This is the parameter to dynamically specify the host name of the host on the receiving side for the Send File or the host name for the Resend File.
Specify the host name as a character string within 68 bytes.
To use this parameter, specify 'Enable Dynamic Specification' for Dynamic Parameter Specification (dynparam) in the System Environment Settings file (hulenv.cnf).
For details on Dynamic Parameter Specification, refer to the following:
HULFT10 for Windows Administration Manual : Send and Receive
- BOOL bResend (IN)
-
Specify the resend flag
- TRUE:
-
Specify the Resend File
- FALSE:
-
Specify the Send File
- SHORT nPriority (IN)
-
Specify the transfer priority
Specify a value from '1' to '256.' To omit this parameter, specify '0.'
- BOOL bSync (IN)
-
Specify the synchronous transfer flag
For the Resend File (bResend = TRUE), you cannot specify Synchronous Transfer.
- TRUE:
-
Carry out Synchronous Transfer
- FALSE:
-
Do not carry out Synchronous Transfer
- INT nWait (IN)
-
Specify the time to wait for the Receive processing results for Synchronous Transfer (seconds)
When you specify the Synchronous Transfer, set the wait time for synchronizing the transfer with the result of processing, in the range from '10' to '259200.' When it reaches the time that you specified, HULFT resumes processing even if it is in the middle of sending. In this case, note that HULFT does not return the transfer results.
The parameter is enabled only when the Synchronous Transfer (bSync=TRUE) is specified. When you do not intend to carry out the Synchronous Transfer (bSync=FALSE), specify '0.'
When you specify '0' for this parameter, HULFT applies the set value of Socket Read Timeout (socktime) in the System Environment Settings file.
- LPCSTR lpszFileName (IN)
-
Specify the file ID of the file to send
Specify a file name with a full path within 200 bytes. To omit this parameter, specify 'NULL.'
In this case, HULFT applies the setting of Send File Name (FILENAME) that is registered in the Send Management Information when you issue the Send File. To use this parameter, specify 'Enable Dynamic Specification' for Dynamic Parameter Specification in the System Environment Settings file. For details on Dynamic Parameter Specification, refer to the following:
HULFT10 for Windows Administration Manual : Send and Receive
For the Resend File, specify the file name of a file that is placed in the Resend Queue. This is not a parameter to dynamically specify the file to resend. If you do not specify this parameter, HULFT resends all transfers that match the host name or file ID specified by the parameters.
- LPCSTR lpszGroup (IN)
-
Specify the transfer group ID of the transfer
Specify the ID as a character string within 50 bytes. To omit this parameter, specify 'NULL.' In this case, HULFT applies the transfer group ID registered in Send Management Information to this parameter to execute the processing. To use this parameter, specify 'Enable Dynamic Specification' for Dynamic Parameter Specification in the System Environment Settings file. For details on Dynamic Parameter Specification, refer to the following:
HULFT10 for Windows Administration Manual : Send and Receive
- BOOL bNp (IN)
-
Specify the Checkpoint flag
For the Send File (bResend=FALSE), be sure to specify 'FALSE.'
- TRUE:
-
Upon the Resend File request, the file transfer resumes from the beginning of the file
- FALSE:
-
Carry out the Checkpoint Resend File (file transfer resumes from the checkpoint)
Returned Value
This function returns '0' if the processing completes successfully. The status when an error occurs is the same as the error code of 'utlsend.exe.'
For details, refer to the following:
HULFT10 for Windows Error Codes and Messages : Send File command (utlsend.exe)
Usage example
Specifying settings when using Visual C++
#include <windows.h> #include <stdio.h> typedef INT (__stdcall *LPUTLSEND)( LPCSTR lpszFileID, LPCSTR lpszHostName, BOOL bResend, SHORT nPriority, BOOL bSync, INT nWait, LPCSTR lpszFileName, LPCSTR lpszGroup, BOOL bNp); int main(int argc, char *argv[]) { CHAR szFileID[50+1]; CHAR szHostName[68+1]; SHORT nPriority; BOOL bResend; BOOL bSync; INT nWait; CHAR szFileName[200+1]; CHAR szGroup[50+1]; BOOL bNp; HMODULE hHulDll; HMODULE hApiDll; LPUTLSEND lpUtlsend; INT nStatus; strcpy_s(szFileID, sizeof(szFileID), "TEST0001"); strcpy_s(szHostName, sizeof(szHostName), ""); bResend = FALSE; nPriority = 50; bSync = TRUE; nWait = 300; strcpy_s(szFileName, sizeof(szFileName), ""); strcpy_s(szGroup, sizeof(szGroup), ""); bNp = FALSE; hApiDll = LoadLibraryEx("C:\\HULFT Family\\hulft10\\bin\\hulapi.dll", NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if (hApiDll == NULL) { printf("Unable to load hulapi.dll." "(Error code = %lu)\n", GetLastError()); FreeLibrary(hHulDll); return 2; } lpUtlsend = (LPUTLSEND)GetProcAddress(hApiDll, "utlsend"); if (lpUtlsend == NULL) { printf("Unable to retrieves the address of HULFT API." "(Error code=%lu)\n", GetLastError()); FreeLibrary(hApiDll); FreeLibrary(hHulDll); return 3; } nStatus = lpUtlsend(szFileID, szHostName, bResend, nPriority, bSync, nWait, szFileName, szGroup, bNp); if (nStatus == 0) { printf("Terminated normally.\n"); } else { printf("Error occurred when calling HULFT API." "(Returned value=%d)\n", nStatus); } FreeLibrary(hApiDll); FreeLibrary(hHulDll); return 0; }