Listen for ICMP packets in C#

前端 未结 7 936
礼貌的吻别
礼貌的吻别 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:45

    There are a number of posts on the web mentioning the problem of ICMP Port Unreachable packets no longer being accessible on Vista.

    • http://www.eggheadcafe.com/software/aspnet/31961998/icmp-port-unreachable-and.aspx
    • http://social.msdn.microsoft.com/Forums/en-US/Offtopic/thread/5bd8b275-cc6f-43cd-949d-7c411973b2f3/

    The stack should give you back an exception when it receives the ICMP. But it doesn't, at least on Vista. And hence you are trying a workaround.

    I don't like answers that say it's not possible, but it seems that way. So I suggest you go back a step to the original problem, which was long timeouts in SIP.

    • You could let the user configure the timeout (hence sort of complying with the spec).
    • You can start doing other things (like checking other proxies) before the timeout ends.
    • You could cache known bad destinations (but that would need good management of the cache.
    • If icmp, and udp don't give proper error messages, try tcp or another protocol. Just to elicit the desired information.

    (Anything is possible, it just may take a lot of resources.)

提交回复
热议问题