The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
goofool

请教使用 golang 在 windows 上发送 icmp 报文的问题

  •  
  •   goofool · Jan 4, 2019 · 2761 views
    This topic created in 2705 days ago, the information mentioned may be changed or developed.
    如下代码,在 windows 上收不上来 time exceeded 的包,但是 wireshark 上可以抓到。
    同样的代码在 linux 上就是好使的。
    有没有小伙伴知道是啥原因啊?

    Supplement 1  ·  Jan 8, 2019
    知道原因了,把 windows 防火墙关掉就好了,
    wireshark 抓包是在防火墙之前。
    1 replies    2019-01-05 15:37:29 +08:00
    katsusan
        1
    katsusan  
       Jan 5, 2019
    https://godoc.org/golang.org/x/net/icmp#ListenPacket

    ListenPacket listens for incoming ICMP packets addressed to address. See net.Dial for the syntax of address.

    For non-privileged datagram-oriented ICMP endpoints, network must be "udp4" or "udp6". The endpoint allows to read, write a few limited ICMP messages such as echo request and echo reply. Currently only Darwin and Linux support this.

    看下面的 example 里 windows 好像是不支持的.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3358 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 49ms · UTC 11:13 · PVG 19:13 · LAX 04:13 · JFK 07:13
    ♥ Do have faith in what you're doing.