利用C# 开发的网络数据包抓取的的实现


利用套接字Socket  socket=new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);

SocketType,Raw
        // 摘要:
        //     支持对基础传输协议的访问。Using the System.Net.Sockets.SocketTypeSystem.Net.Sockets.SocketType.Raw,
        //     you can communicate using protocols like Internet Control Message Protocol
        //     (System.Net.Sockets.ProtocolType.Icmp) and Internet Group Management Protocol
        //     (System.Net.Sockets.ProtocolType.Igmp).在发送时,您的应用程序必须提供完整的 IP 标头。所接收的数据报在返回时会保持其
        //     IP 标头和选项不变。

绑定终结点Bind函数实现

socket.Blocking = false;
socket.Bind(new IPEndPoint(ipaddress, 0));//要监听的IP地址、

//开始异步监听网络数据包

 socket.BeginReceive(receive_buf_bytes, 0, len_receive_buf, SocketFlags.None, new AsyncCallback(CallBack), stat);


下图是本人开发的工具界面

C# 开发的网络数据包抓取的的实现

需要下载的可联系 [email protected]

相关文章:

  • 2021-12-02
  • 2021-06-21
  • 2022-12-23
  • 2021-07-03
  • 2021-09-10
  • 2022-12-23
  • 2021-07-30
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-22
  • 2022-12-23
  • 2022-02-01
  • 2021-08-20
  • 2021-11-20
  • 2021-07-10
相关资源
相似解决方案