初级会员
- 积分
- 88
- 金钱
- 88
- 注册时间
- 2019-4-20
- 在线时间
- 11 小时
|
楼主 |
发表于 2019-8-28 17:18:24
|
显示全部楼层
现在有了一点思路 通过观察回调函数中 这个判断发现 当前绑定的是69端口,只能接收到RRQ 和 WRQ两种命令 所以无法直接将判断条件修改为TFTP_DATA解决,还有一个问题是根据TFTP协议,服务器接收第一个包用的是69端口,但之后就会新建一个端口用来回消息,那么我如何知道新的端口是多少 如何接收DATA包
switch (op)
{
case TFTP_RRQ: /* TFTP RRQ (read request) 客户端要求接收TFTP数据,服务器发送数据命令*/
/* Read the name of the file asked by the client to be sent from the SD card */
tftp_extract_filename(FileName, pkt_buf->payload);
/* Start the TFTP read mode*/
tftp_process_read(upcb, addr, port, FileName);
break;
case TFTP_WRQ: /* TFTP WRQ (write request) 客户端发TFTP数据请求,服务器接收数据命令*/
/* Read the name of the file asked by the client to received and writen in the SD card */
tftp_extract_filename(FileName, pkt_buf->payload);
//在这个加入擦FALSH
/* Initialize FlashDestination variable */
FlashDestination = ApplicationAddress;
/* Erase the needed pages where the user application will be loaded */
/* Define the number of page to be erased */
NbrOfPage = FLASH_PagesMask(0x10000);//擦除64K
/* Erase the FLASH pages */
for (EraseCounter = 0; (EraseCounter < NbrOfPage) && (FLASHStatus == FLASH_COMPLETE); EraseCounter++)
{
FLASHStatus = FLASH_ErasePage(FlashDestination + (PageSize * EraseCounter));
}
/* Start the TFTP write mode*/
tftp_process_write(upcb, addr, port, FileName);
break;
default:
/* sEndTransfera generic access violation message */
tftp_send_error_message(upcb, addr, port, TFTP_ERR_ACCESS_VIOLATION);
/* TFTP unknown request op */
/* no need to use tftp_cleanup_wr because no "tftp_connection_args" struct has been malloc'd */
udp_remove(upcb);
break;
} |
|