TFTP C++没有收到ACK

问题描述:

我在写一个使用C++的TFTP客户端。我能够使用“octet”模式将读取请求发送到默认的TFTP客户端(tftpd32)。问题是我无法在常规的TFTP响应中发回ACK。我收到以下错误:TFTP C++没有收到ACK

Connection received from 127.0.0.1 on port 51401 [27/07 23:03:15.612] 
Read request for file <test.txt>. Mode octet [27/07 23:03:15.612] 
Using local port 51402 [27/07 23:03:15.612] 
Connection received from 127.0.0.1 on port 51401 [27/07 23:03:18.624] 
Unexpected request 4 from peer [27/07 23:03:18.624] 
Returning EBADOP to Peer [27/07 23:03:18.624] 

为什么我能够使用相同的方法发送RRQ而不是ACK?

+0

使用工具,如Wireshark来找出什么是beeing通过电线发送。也许这可以更容易地发现错误。 – rve 2012-08-25 09:56:44

可能是一个没有很好符合的ACK数据包? 它看起来像您发送一个ACK操作码的请求......

的ACK信息包从RFC 1350的形式:

    2 bytes  2 bytes 
       --------------------- 
       | Opcode | Block # | 
       --------------------- 

其中操作码= 4