Skip to content

net: Dial/Listen with "ip4:tcp" or "ip6:tcp" fails on Windows #23193

@ilyaigpetrov

Description

@ilyaigpetrov

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions