Instant Transfer Send File API

This API issues a Send File request for instant transfer.

Syntax

INT __stdcall utlsendit( LPCSTR lpszFileName , LPCSTR lpszHostName , 
              LPCSTR lpszRcvLocationPath , LPCSTR lpszRcvFileName , 
              TCHAR cMode , USHORT portnum ,SHORT nPriority , BOOL bSync );

Explanation of the parameters

LPCSTR lpszFileName (IN)

Specify the file name of the file to send.

Specify the file name as a character string within 200 bytes.

LPCSTR lpszHostName (IN)

Specify the host name of the destination host for sending.

Specify the host name as a character string within 68 bytes.

LPCSTR lpszRcvLocationPath (IN)

Specify the save destination of the file to receive.

Specify the save destination as a character string within 200 bytes. To omit this parameter, specify "NULL".

LPCSTR lpszRcvFileName (IN)

Specify the name of the file to receive.

Specify the file name as a character string within 200 bytes. To omit this parameter, specify "NULL".

TCHAR cMode (IN)

Specify the transfer type.

t:

Text transfer

b:

Binary transfer

USHORT portnum (IN)

Specify the port number of the host on the receiving side.

Specify a value from "1" to "65535". To omit this parameter, specify "0".

Omitting this parameter sets "30000".

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.

TRUE:

Execute Synchronous Transfer

FALSE:

Do not execute Synchronous Transfer

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 "utlsendit.exe."

For details, refer to Error Codes and Messages.

<Usage example>

Example for Visual C++

#include <windows.h>
#include <stdio.h>

typedef INT (__stdcall *LPUTLSENDIT)( 
        LPCSTR lpszFileName, LPCSTR lpszHostName, 
        LPCSTR lpszRcvLocationPath, LPCSTR lpszRcvFileName, 
        TCHAR cMode, USHORT portnum, SHORT nPriority, BOOL bSync, INT nWait); 

int main() 
{ 
    CHAR szFileName[200+1]; 
    CHAR szHostName[68+1]; 
    CHAR szRcvLocationPath[200+1]; 
    CHAR szRcvFileName[200+1]; 
    CHAR cMode; 
    USHORT portnum; 
    SHORT nPriority; 
    BOOL bSync; 
    INT nWait; 
    HMODULE hHulDll; 
    HMODULE hApiDll; 
    LPUTLSENDIT lpUtlsendit; 
    INT nStatus; 

    strcpy_s(szFileName, sizeof(szFileName), "C:\\HULFT Family\\sndfile.txt"); 
    strcpy_s(szHostName, sizeof(szHostName), "RCV_HOST"); 
    strcpy_s(szRcvLocationPath, sizeof(szRcvLocationPath), ""); 
    strcpy_s(szRcvFileName, sizeof(szRcvFileName), ""); 
    cMode = 'T'; 
    portnum = 30000; 
    nPriority = 50; 
    bSync = TRUE; 
    nWait = 300; 

    hHulDll = LoadLibrary("C:\\HULFT Family\\hulft8\\bin\\hulftrt.dll"); 
    if (hHulDll == NULL) 
    { 
        printf("Unable to load hulftrt.dll." 
            "(Error code=%lu)\n", GetLastError()); 
        return 1; 
    } 
    hApiDll = LoadLibrary("C:\\HULFT Family\\hulft8\\bin\\hulapi.dll"); 
    if (hApiDll == NULL) 
    { 
        printf("Unable to load hulapi.dll." 
            "(Error code=%lu)\n", GetLastError()); 
        FreeLibrary(hHulDll); 
        return 2; 
    } 
    lpUtlsendit = (LPUTLSENDIT)GetProcAddress(hApiDll, "utlsendit"); 
    if (lpUtlsendit == NULL) 
    { 
        printf("Unable to retrieves the address of HULFT API." 
            "(Error code=%lu)\n", GetLastError()); 
        FreeLibrary(hApiDll); 
        FreeLibrary(hHulDll); 
        return 3; 
    } 
    nStatus = lpUtlsendit(szFileName, szHostName, szRcvLocationPath, szRcvFileName, 
        cMode, portnum, nPriority, bSync, nWait); 
    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; 
}