TFTP Support Calls
5-10
5.3
TFTP Support Calls
5.3.1
Synopsis
TFTP is supported via the received function. More information on TFTP can
be found in rfc783.
5.3.2
TFTP Support API Functions
TFTP is accessed through this API. The network tools, include file NET-
TOOLS.H, is required.
Retrieve Data from a TFTP Server
NtTftpRecv
Syntax
int NtTftpRecv( UINT32 TftpIp, char *szFileName, char *pFileBuffer, UINT32
*pFileSize, UINT16 *pErrorCode );
Parameter(s)
TftpIp
IP Address in network format
szFileName
Pointer to null terminated filename string
pFileBuffer
Pointer to buffer to receive file data
pFileSize
Pointer to size of buffer on input, returns as size needed or
used
pErrorCode
Pointer to where to write TFTP server error code (if any)
Return Value
This function returns an error code indicating the results of the operation. Neg-
ative codes are error conditions.
In the following cases, pFileSize is set to the actual file size:
-
1 – Successful transfer and copy
-
0 – Successful transfer, with partial copy (file size too large)
In the following cases, pFileSize is set to the actual number of bytes copied:
TFTPERROR_ERRORREPLY Error returned by TFTP server (see
below)
TFTPERROR_BADPARAM
Invalid calling parameters
TFTPERROR_RESOURCES
Memory allocation error during trans-
fer
TFTPERROR_SOCKET
Internal socket error during transfer
TFTPERROR_FAILED
TFTP failed (e.g., server didn’t reply)
In the case of TFTPERROR_ERRORREPLY, the server error code written to
*pErrorCode should be one of the following standard TFTP codes, and the er-
ror message is copied to *pFileBuffer: