Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: ListenIP can't use on Linux(Ubuntu) but goot at windows #7439

gopherbot opened this issue Mar 2, 2014 · 2 comments

net: ListenIP can't use on Linux(Ubuntu) but goot at windows #7439

gopherbot opened this issue Mar 2, 2014 · 2 comments


Copy link

@gopherbot gopherbot commented Mar 2, 2014

by jikai507:

My code blow:

package main

import (
    . "fmt"

func main() {
    addr := net.IPAddr{
        IP: net.ParseIP(""),
    ipls, err := net.ListenIP("ip", &addr)
    if err != nil {
    defer ipls.Close()

What is the expected output?
It sill compile success on windows.

What do you see instead?
listen ip 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?
Copy link

@mikioh mikioh commented Mar 3, 2014

Comment 1:

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.

Status changed to Invalid.

Copy link

@gopherbot gopherbot commented Mar 6, 2014

Comment 2 by jikai507:

лл  ��������
2014��3��3�� ����10:27�� <>���
@gopherbot gopherbot added the invalid label Mar 6, 2014
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants