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: Dial/Listen with "ip4:tcp" or "ip6:tcp" fails on Windows #23193

Closed
ilyaigpetrov opened this issue Dec 20, 2017 · 4 comments

Comments

Projects
None yet
4 participants
@ilyaigpetrov
Copy link

commented Dec 20, 2017

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.9.2 windows/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

$ go env
set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\ilyaigpetrov\go
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config

Windows 10

What did you do?

package main

import (
	"fmt"
	"net"
)

func main() {
  _, err := net.DialIP("ip:tcp", nil, &net.IPAddr{IP: net.IPv4(127, 0, 0, 1)})
  // _, err := net.DialIP("ip4:6", nil, &net.IPAddr{IP: net.IPv4(127, 0, 0, 1)}) // the same error
  if err != nil {
    fmt.Println("ERR", err)
  } else {
    fmt.Println("No error!")
  }
}

What did you expect to see?

DialIP must work without errors.

What did you see instead?

ERR dial ip:tcp 127.0.0.1: connect: An invalid argument was supplied.
or
socket: protocol not supported (Bash for Windows)

@ilyaigpetrov ilyaigpetrov changed the title `net.DialIP("ip:tcp"` on Windows -> "An invalid argument was supplied" net.DialIP("ip:tcp" on Windows -> "An invalid argument was supplied" Dec 20, 2017

@bradfitz bradfitz added this to the Go1.11 milestone Dec 20, 2017

@bradfitz

This comment has been minimized.

Copy link
Member

commented Dec 20, 2017

/cc @mikioh

@mikioh mikioh changed the title net.DialIP("ip:tcp" on Windows -> "An invalid argument was supplied" net: Dial/Listen with "ip4:tcp" or "ip6"tcp" fails on Windows Dec 20, 2017

@mikioh

This comment has been minimized.

Copy link
Contributor

commented Dec 20, 2017

I'm not a Windows user and have no Windows stuff, but when googling with "sock_raw+tcp" I found the following: https://msdn.microsoft.com/en-us/library/windows/desktop/ms740548(v=vs.85).aspx

See the section of Limitations on Raw Sockets.

@mikioh mikioh closed this Dec 20, 2017

@ilyaigpetrov

This comment has been minimized.

Copy link
Author

commented Dec 21, 2017

Please, mention that peculiarity in the documentation, so people don't waste time seeking for answers.

@mikioh

This comment has been minimized.

Copy link
Contributor

commented Dec 21, 2017

@ilyaigpetrov,

Feel free to open a new issue for documentation.

@mikioh mikioh changed the title net: Dial/Listen with "ip4:tcp" or "ip6"tcp" fails on Windows net: Dial/Listen with "ip4:tcp" or "ip6:tcp" fails on Windows Dec 22, 2017

@golang golang locked and limited conversation to collaborators Dec 22, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.