你怎么际preT这句话? [英] How do you interpret this phrase?

查看:184
本文介绍了你怎么际preT这句话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你怎么际preT这句话?

How do you interpret this phrase?

校验结果
  这是为了零上增加的低8位从标题到检验值。

Checksum
This is the value to make zero on the addition of the lower 8 bits from the header to the checksum.

通过此协议说明:

协议结果
  由首标(1个字节)+数据长度(1字节)的+
  命令数据(13字节)+校验和(1字节)+连接ID(1
  字节)。

Protocol
Consist of header (1 byte) + data length (1 byte) + command data (13 bytes) + check sum (1 bytes) + connection ID (1 byte).

(我简直复制该协议说明,因此I'dont知道为什么会出现 1字节(复数形式),但我可以告诉你这只是一个字节)

(I literally copied this protocol description, so I'dont know why there is 1 bytes (in plural). But I can tell you it is only one byte)

下面是该协议的一些样本的TCP数据包:

Here are some sample TCP packets of this protocol:

HE:DL:------------Command Data -------------:CS:ID
02:0d:be:ef:03:06:00:19:d3:02:00:00:60:00:00:ed:01
02:0d:be:ef:03:06:00:cd:d2:02:00:00:20:00:00:7a:01
02:0d:be:ef:03:06:00:10:f6:02:00:ba:30:00:00:49:01
02:0d:be:ef:03:06:00:c8:d8:02:00:20:30:00:00:49:01
// Requested Packets
02:0d:be:ef:03:06:00:13:d3:01:00:02:30:01:00:21:01
02:0d:be:ef:03:06:00:c2:ff:02:00:90:10:00:00:d8:01

其中,


  • HE 是头(被固定到 0×02

  • DL 是数据长度(这始终是符进行,因为数据包都是相同的长度)

  • CS 是校验(这是我的问题关于)

  • ID 是连接ID(似乎总是在我的测试01)

  • HE is the HEader (which is fixed to 0x02)
  • DL is the DataLength (which is always 0x0d, because the packets are all the same length)
  • CS is the CheckSum (which is my question about)
  • ID is the connection ID (seems to be always 01 in my tests)

校验的计算方式我想不通。我希望我给了足够的信息。

I can't figure out how the checksum is computed. I hope I gave enough info.

先谢谢了。

推荐答案

我觉得在描述有只是一个错误。看起来他们正在总结所有的报头和校验和字节。和校验和是只是一个数字,清除低8位。因此,对于第一实施例中,所有的总和头之间字节和校验和是0x0313。或

I think there's just an error in the description. It looks like they are summing all the bytes between the header and the checksum. And the checksum is just a number that clears the lower 8 bits. So, for the first example, the sum of all bytes between the header and the checksum is 0x0313. Or

0x0313 0000 0011 0001 0011
0x00ED 0000 0000 1110 1101

当它一字排开那样,你可以清楚地看到你会被清零的低8位和返回:

When it's lined up like that, you can clearly see you'll be zeroing out the lower 8 bits and returning:

0x0400 0000 0100 0000 0000

您没有指定的语言,但你也可以迅速通过做(0 XOR calculatedSum)+ 1计算自己的校验和。

You didn't specify a language, but you could also quickly calculate your own checksum by doing (0 XOR calculatedSum) + 1.

这篇关于你怎么际preT这句话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆