V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
goofool
V2EX  ›  Go 编程语言

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

  •  
  •   goofool · 2019-01-04 17:18:30 +08:00 · 2258 次点击
    这是一个创建于 1910 天前的主题,其中的信息可能已经有所发展或是发生改变。
    如下代码,在 windows 上收不上来 time exceeded 的包,但是 wireshark 上可以抓到。
    同样的代码在 linux 上就是好使的。
    有没有小伙伴知道是啥原因啊?

    第 1 条附言  ·  2019-01-08 16:56:29 +08:00
    知道原因了,把 windows 防火墙关掉就好了,
    wireshark 抓包是在防火墙之前。
    1 条回复    2019-01-05 15:37:29 +08:00
    katsusan
        1
    katsusan  
       2019-01-05 15:37:29 +08:00
    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 好像是不支持的.
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   937 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 20:50 · PVG 04:50 · LAX 13:50 · JFK 16:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.