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("tcp", "addr:port") fails on Windows #31433

Closed
weiyixuan opened this Issue Apr 12, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@weiyixuan
Copy link

commented Apr 12, 2019

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

$ go version
go version go1.11.3 windows/amd64

Does this issue reproduce with the latest release?

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

go env Output
$ go env
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Caleb\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\Caleb\go
set GOPROXY=
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
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
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\Caleb\AppData\Local\Temp\go-build366274902=/tmp/go-build -gno-record-gcc-switches

What did you do?

var netAddr net.Addr
netAddr = &net.TCPAddr{}
netAddr.(*net.TCPAddr).IP = net.ParseIP("172.20.32.62")
dialer := net.Dialer{LocalAddr: netAddr}
dialer.Dial(network, address)

What did you expect to see?

dialer.Dial should not cause error

What did you see instead?

(Firewall closed)
dial tcp 192.168.31.193:0->222.73.182.66:80: connectex: The requested address is not valid in its context.
dial tcp 192.168.31.193:0->42.81.100.253:80: connectex: The requested address is not valid in its context.
dial tcp 192.168.31.193:0->112.65.249.214:80: connectex: The requested address is not valid in its context.

@imkos

This comment has been minimized.

Copy link

commented Apr 12, 2019

@bcmills

This comment has been minimized.

Copy link
Member

commented Apr 12, 2019

@weiyixuan, the example you provided is incomplete: it refers to an address variable, but there is no such variable defined in the code snippet.

Please provide a self-contained code example that illustrates the problem.

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