How send raw ethernet packet with C#?(如何使用 C# 发送原始以太网数据包?)
问题描述
有没有办法通过 C# 将原始数据包以太网发送到其他主机?在 Windows 7 中,如果它有所作为.
Is there a way to send raw packet Ethernet to other host via C#? In Windows 7 if it makes difference.
推荐答案
根据 Saint_pl 的建议:
Based on suggestion by Saint_pl:
我找到了可能更好的解决方案 - 类似于 SharpPcap.它是 Pcap.Net - WinPcap 的 .NET 包装器.现在我可以随意修改我的数据包了.
I found probably better solution - similar to SharpPcap. It's Pcap.Net - .NET wrapper for WinPcap. Now I can modify my packets whatever I want.
<小时>
我有一些资源可能对你有帮助.我没有在 Windows 7 中尝试该解决方案,但它可能包含一些很好的开始信息.
I have some resources for you that maybe helpful. I don't try that solutions in Windows 7 but maybe it contains some good info to start.
原始以太网数据包操作 或 CodeProject 上的镜像
本文的目的是解释如何在 Microsoft 平台上使用 C# 发送原始以太网数据包.原始以太网数据包是发送到物理线路的完整第 2 层网络帧.发送这样的帧允许您操纵目标和源 MAC 地址以及第 3 层协议字段.
This purpose of this article is to explain how to send a raw Ethernet packet using C# on a Microsoft platform. A raw Ethernet packet is the complete Layer 2 network frame that is sent to the physical wire. Sending a frame like this allows you to manipulate the target and source MAC addresses and the Layer 3 protocol fields.
还有一些关于原始套接字的信息(以防你也感兴趣):
Also some info on raw sockets (just in case you interesting too):
客户端(和服务器)套接字通信看一看整章,但这里是关键部分:
Client (and Server) Sockets Communication take a look on whole chapter but here key parts:
- C# 原始 UDP 套接字程序示例
- C# Raw Socket Ping 程序示例part A |B部分
- 所有示例
不发送数据包但可能很有趣:C# 中的网络嗅探器,SharpPcap - .NET 的数据包捕获框架
Not sending packets but maybe interesting: A Network Sniffer in C#, SharpPcap - A Packet Capture Framework for .NET
这篇关于如何使用 C# 发送原始以太网数据包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用 C# 发送原始以太网数据包?
基础教程推荐
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- WPF 模态进度窗口 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
