Search code examples
vxworkserror-codetftp

tftpGet error from tftpLib in VxWorks


I'm writing a little function that downloads a file from a TFTP server using VxWork's tftpLib (http://www.vxdev.com/docs/vx55man/vxworks/ref/tftpLib.html) - now I realized that my tftpGet() command is returning an error 1 but I'm not sure what errorcode 1 means. On the posted website it says:

ERRNO
S_tftpLib_INVALID_DESCRIPTOR
S_tftpLib_INVALID_ARGUMENT
S_tftpLib_NOT_CONNECTED

But how do I know what 1 corresponds with? The get portion of my code looks like this:

/* Initialize and createlocal file handle */
pFile = fopen("ngfm.bin","wb");
if (pFile != NULL)
    {
    /* Get file from TFTP server and write it to the file descriptor */
    status = tftpGet (pTftpDesc, pFilename, pFile, TFTP_CLIENT);
    printf("GOT %s\n",pFilename);
    }
else
    {
    printf("Error in tftpGet()\nfailed to get %s from %s\nERRNO %d",pFilename,pHost, status);
    }

Solution

  • No,The problem in fact was, that I didn';t get a valid file pointer but NULL because there's no such thing as a "current directory" like in Linux in VxWorks but I had to change my fopen to say something like pFile = fopen("flash:/ngfm.bin","wb"); instead.