网络——数据填充

发布于 2024-08-18 08:07:03 字数 364 浏览 2 评论 0原文

对于家庭作业,我的任务是创建一个位于以太网堆栈正上方的“乒乓”层。

我能够轻松完成任务,但是当我通过无线连接测试我的应用程序并尝试与同一网络上的台式计算机(以太网)通信时,我发现了一些奇怪的行为。

看起来数据包中填充了我没有添加的信息。 从无线->以太网我得到类似以下内容的内容(作为接收到的数据的十六进制输出,去掉以太网标头,句点是不可打印的字符)。

3-468...lkin54g......$ 0Hl.........*../..2..

当我的台式机响应我的笔记本电脑(以太网 -> 无线)时,我得到类似以下内容的

3-468........ ………… ............

这是预期的行为吗?

For a homework assignment, I was tasked with creating a "Ping Pong" layer that sits right above the Ethernet stack.

I was able to easily complete the task but when I tested my application over my wireless connection and tried communication with my desktop computer (ethernet) on the same network I found some odd behavior.

It seems like the packet is being padded with information I did not add.
From wireless->ethernet I get something like the following (as a hex output of the data received, taking off the ethernet header, periods are unprintable characters).

3-468...lkin54g......$
0Hl.........*../..2..

When my desktop responds to my laptop (ethernet->wireless) I get something like the following

3-468................
.....................

Is this expected behavior?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我偏爱纯白色 2024-08-25 08:07:03

是的。有效的以太网帧的最小大小为 64 字节(包括以太网标头和末尾的 4 字节校验和)。

Yes. Valid Ethernet frames have a minimum size of 64 bytes (including the Ethernet header and a 4-byte checksum at the end).

帝王念 2024-08-25 08:07:03

当您通过网络发送数据包时,您发送的数据会在 OSI 网络层模型的每个级别被包装成连续更大的数据结构。当您的操作系统收到信息包时,它会在数据向上传输时解开数据包。阅读有关 OSI 模型 的更多信息可能有助于更好地理解。

这是一张图片,说明了每一层发生的情况,来自电子书

When you send packets across the network, the data you are sending is wrapped up into successively larger data structures at each level of the OSI network layer model. When your operating system receives the packets of information, it unwraps the data as it goes up the layers. Reading more about the OSI model could be useful for better understanding.

Here is a picture that illustrates what is going on at each layer, from an ebook.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文