Listen for ICMP packets in C#

前端 未结 7 907
礼貌的吻别
礼貌的吻别 2020-12-03 00:30

I have a SIP application that needs to send UDP packets to set up the SIP calls. SIP has a timeout mechanism to cope with delivery failures. An additional thing I would like

7条回答
  •  时光取名叫无心
    2020-12-03 00:44

    So you want to pick up the dest unreachable return icmp packet programmatically? A tough one. I'd say the network stack soaks that up before you can get anywhere near it.

    I don't think a pure C# approach will work here. You'll need to use a driver level intercept to get a hook in. Take a look at this app that uses windows' ipfiltdrv.sys to trap packets (icmp,tcp,udp etc) and read/play with them with managed code (c#).

    http://www.codeproject.com/KB/IP/firewall_sniffer.aspx?display=Print

    • Oisin

提交回复
热议问题