You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My code blow:
package main
import (
. "fmt"
"net"
)
func main() {
addr := net.IPAddr{
IP: net.ParseIP("127.0.0.1"),
}
ipls, err := net.ListenIP("ip", &addr)
if err != nil {
Println(err.Error())
return
}
defer ipls.Close()
}
What is the expected output?
It sill compile success on windows.
What do you see instead?
listen ip 127.0.0.1: protocol not supported
Which operating system are you using?
ubuntu 12.04
Which version are you using? (run 'go version' or 'gccgo --version')
go v1.2
Please provide any additional information below.
I also try to use syscall.Socket(syscall.AF_PACKET, syscall.SOCK_RAW, syscall.IPPROTO_IP)
but when I want to send a buf to an ip address, what address struct should I use?
The text was updated successfully, but these errors were encountered:
The first argument of ListenIP should be "network"+":"+"protocol on top of the IPv4 or
IPv6". For example,
ListenIP("ip4:1", ...) // ICMP for IPv4
ListenIP("ip4:ospf", ...) // OSPFv2 for IPv4
ListenIP("ip6:58", ...) // ICMP for IPv6
ListenIP("ip6:gre", ...) // GRE over IPv6
> ... try to use syscall.Socket(syscall.AF_PACKET, ...
Syscall API is almost the same as C libary API, so syscall.RawSockaddrLinklayer.
by jikai507:
The text was updated successfully, but these errors were encountered: