我使用tcp_info打印出有关特定套接字的信息。 我使用tcpi_total_retrans打印出重传的数据包总数。但是,当我将结果与重传数据包的tcpdump结果进行比较时,它是不同的(tcpi_total_retrans显示的数字大于tcpdump)。任何想法为什么会发生这种情况?是不是tcpi_total_retrans假设要计算重传的数据包总数? 我正在修改名为BWdetail的工具的代码以打印出重新传输的数据包总数,您可以找到工具代码here。 另外,我在运行该工具之前运行tcpdump,然后在工具运行完毕后直接将其终止。 这是tcpdump输出:
a->b: b->a:
total packets: 81852 total packets: 130675
ack pkts sent: 81852 ack pkts sent: 130675
pure acks sent: 0 pure acks sent: 130675
sack pkts sent: 0 sack pkts sent: 0
dsack pkts sent: 0 dsack pkts sent: 0
max sack blks/ack: 0 max sack blks/ack: 0
unique bytes sent: 1088069192 unique bytes sent: 0
actual data pkts: 81852 actual data pkts: 0
actual data bytes: 1088083672 actual data bytes: 0
rexmt data pkts: 10 rexmt data pkts: 0
rexmt data bytes: 14480 rexmt data bytes: 0
zwnd probe pkts: 0 zwnd probe pkts: 0
zwnd probe bytes: 0 zwnd probe bytes: 0
outoforder pkts: 0 outoforder pkts: 0
pushed data pkts: 2737 pushed data pkts: 0
SYN/FIN pkts sent: 0/0 SYN/FIN pkts sent: 0/0
req 1323 ws/ts: N/Y req 1323 ws/ts: N/Y
urgent data pkts: 0 pkts urgent data pkts: 0 pkts
urgent data bytes: 0 bytes urgent data bytes: 0 bytes
mss requested: 0 bytes mss requested: 0 bytes
max segm size: 33304 bytes max segm size: 0 bytes
min segm size: 1448 bytes min segm size: 0 bytes
avg segm size: 13293 bytes avg segm size: 0 bytes
max win adv: 192 bytes max win adv: 232 bytes
min win adv: 192 bytes min win adv: 181 bytes
zero win adv: 0 times zero win adv: 0 times
avg win adv: 192 bytes avg win adv: 228 bytes
initial window: 17376 bytes initial window: 0 bytes
initial window: 1 pkts initial window: 0 pkts
ttl stream length: NA ttl stream length: NA
missed data: NA missed data: NA
truncated data: 1087756264 bytes truncated data: 0 bytes
truncated packets: 81852 pkts truncated packets: 0 pkts
data xmit time: 9.986 secs data xmit time: 0.000 secs
idletime max: 15.7 ms idletime max: 15.3 ms
throughput: 108955360 Bps throughput: 0 Bps
谢谢。