OSI 第 2 层网络编程

发布于 2024-12-10 14:00:22 字数 276 浏览 0 评论 0原文

我最近参加了一些网络课程(CCNA 1 到 4),因此我了解其背后的大部分理论。我现在想做的是将我所拥有的知识以一些小应用程序的形式付诸实践。

我一直在阅读 MSDN 上关于如何执行此操作的一些文章,但它们似乎只涵盖第 3 层或第 4 层及以上的网络编程,IIRC。我正在寻找一些简单示例,说明如何处理主机之间的第二层连接(即成帧),甚至只是一些简单的示例,例如如何执行以太网广播。

我对 C# 和 C++ 有一点经验,因此使用这两种语言中的任何一种的示例都很棒。

谢谢。

I've recently taken some classes in networking (CCNA 1 through 4), so I understand most of the theory behind it all. What I'd like to do now is take that knowledge I have and put it into practice in the form of some small applications.

I've been reading through some articles on MSDN on how to do this, but they seem to only cover network programming at layer 3 or 4 and upwards, IIRC. What I'm looking for is some simple examples of how to deal with layer two connectivity (ie. framing) between hosts, or even just something simple like how to perform an Ethernet broadcast.

I have a little experience with C# and C++, so examples which use either of those languages would be great.

Thanks.

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

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

发布评论

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

评论(3

-黛色若梦 2024-12-17 14:00:22

对于 Windows,请查看 WinPcap,它提供低级网络访问。开发人员包已包含一些简单的示例来帮助您入门。

顺便说一句,在 Linux 上有数据包套接字

For Windows, have a look at WinPcap which provides low-level network access. The developer pack already contains some simple examples to get you started.

BTW, on Linux there are packet sockets.

黎歌 2024-12-17 14:00:22

您可以使用 eEx Network Library 来编写小型应用程序(我在 CCNA 期间也做过同样的事情)。

它是一个易于使用且面向对象的 .Net 编程库,可让您深入到第 2 层并通过 WinPcap 发送自定义帧。

实现了以太网、ARP、IP、UDP、TCP 和 RIP 等帧类型,据我所知,这些是 CCNA 期间出现的协议。

C# 教程可在此处找到,如果您想查看一些深入的东西,比如地址解析,你总是可以查看源代码,因为该库是开源的。

You could use the eEx Network Library to write small apps (I have done the same thing during my CCNA).

It is an easy-to-use and object-oriented .Net programming library, which lets you go down to layer 2 and send out custom frames via WinPcap.

Frame types like Ethernet, ARP, IP, UDP, TCP and RIP are implemented, and as far as I know, these are protocols which occur during CCNA.

Tutorials in C# are available here, and if you want look at something in depth, like address resolution, you can always have a look at the source code, since the library is open source.

情归归情 2024-12-17 14:00:22

您很可能可以研究 GNU/Linux 系统上的低级网络实用程序,或者研究内核 TCP 或 UDP 或 IP 层。但例如,进行以太网广播是非常低级的事情,而且不是很有用。真实的示例(通常用 C 编码,而不是 C++ 编码)可能不会很简单,因为它们必须处理错误处理。

Very probably, you could study low-level network utilities on GNU/Linux systems, or also look into the kernel TCP or UDP or IP layers. But for instance, doing an Ethernet broadcast is something very low level, and not very useful. And real examples (usually coded in C, not C++) probably can't be simple because they have to deal with error handling.

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