Я написал на VxWorks некоторый код для загрузки файла с TFTP-сервера с использованием tftpLib
, но get дает мне тайм-аут:
ERR [TFTP] tftpSend:479: Transfer Timed Out.
ERR [TFTP] tftpGet:1077: File transfer error.
Error has occurred: 4915207
что неправильно, так как хост доступен:
ping("3.94.213.53",3)
Pinging 3.94.213.53 (3.94.213.53) with 64 bytes of data:
Reply from 3.94.213.53 bytes=64 ttl=63 seq=0 time<1ms
Reply from 3.94.213.53 bytes=64 ttl=63 seq=1 time<1ms
Reply from 3.94.213.53 bytes=64 ttl=63 seq=2 time<1ms
и когда я делаю это из оболочки Linux, все работает так, как и ожидалось:
tftp -r "artifacts/ngfm.bin" -g 3.94.213.53
В чем здесь может быть проблема? Раздел get моего кода выглядит так:
pFile = fopen("flash:/ngfm.bin","wb");
if (pFile != NULL) {
/* Get file from TFTP server and write it to the file descriptor */
if (OK == (status = tftpGet (pTftpDesc, pFilename, pFile, TFTP_CLIENT))) {
printf("tftpGet() successful\n");
} else {
printf("Error has occurred: %d\n", errno); // errno is where the error is stored
}
} else {
printf("Bad file pointer pFile");
}
изменить:
Код, который у меня есть над частью получения:
/*Initiate TFTP session*/
if ((pTftpDesc = tftpInit ()) == NULL)
printf("Error on tftpInit()\n");
/*connect to TFTP host and set transfer mode*/
if ((tftpPeerSet (pTftpDesc, pHost, port) == ERROR) ||
(tftpModeSet (pTftpDesc, pMode) == ERROR)) {
(void) tftpQuit (pTftpDesc);
printf("Error on tftpPeerSet()\n");
return ERROR;
}
7263 579.036996 3.94.213.214 3.94.213.53 TFTP 77 Read Request, File: artifacts/ngfm.bin, Transfer type: octet, tsize\000=0\000
против VxWorks:81921 748.913374 3.94.213.214 3.94.213.53 TFTP 69 Read Request, File: artifacts/ngfm.bin, Transfer type: octet
- person stdcerr   schedule 06.12.2013tsize
должно быть больше 0, так как это общий размер. Можете ли вы вставить передачу TFTP в свой OP? просто скопируйте описание TFTP пакета (щелкните правой кнопкой мыши строку TFTP и выберите «Описание») - person Noam Rathaus   schedule 06.12.2013