What version of Go are you using (go version)?
$ go version
go version go1.11.4 windows/amd64
Does this issue reproduce with the latest release?
Yes
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\Administrator\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Project\Go\maas
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\Administrator\AppData\Local\Temp\go-build757481154=/tmp/go-
build -gno-record-gcc-switches
What did you do?
The below code response: Connection success: 118.163.120.170:443
dialer := &net.Dialer{
Timeout: time.Millisecond * time.Duration(1000),
}
config := &tls.Config{
InsecureSkipVerify: true,
}
conn, err := tls.DialWithDialer(dialer, "tcp", "www.globaltrust.com.tw:443", config)
if err != nil {
log.Println("Connection error: " + err.Error())
} else {
log.Println("Connection success: " + conn.RemoteAddr().String())
}
if conn != nil {
_ = conn.Close()
}
The below code response: Connection error: read tcp 192.168.220.222:57388->118.163.120.170:443: wsarecv: An existing connection was forcibly closed by the remote host.
dialer := &net.Dialer{
Timeout: time.Millisecond * time.Duration(1000),
}
config := &tls.Config{
InsecureSkipVerify: true,
}
conn, err := tls.DialWithDialer(dialer, "tcp", "118.163.120.170:443", config)
if err != nil {
log.Println("Connection error: " + err.Error())
} else {
log.Println("Connection success: " + conn.RemoteAddr().String())
}
if conn != nil {
_ = conn.Close()
}
In fact, www.globaltrust.com.tw is 118.163.120.170, why different results if using domain or real IP?
What did you expect to see?
the both code should connect to remote successfully, no matter using domain or real IP.
What did you see instead?
Only this web site has the issue that failed to connect to remote if using an real IP.
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
The below code response: Connection success: 118.163.120.170:443
The below code response: Connection error: read tcp 192.168.220.222:57388->118.163.120.170:443: wsarecv: An existing connection was forcibly closed by the remote host.
In fact, www.globaltrust.com.tw is 118.163.120.170, why different results if using domain or real IP?
What did you expect to see?
the both code should connect to remote successfully, no matter using domain or real IP.
What did you see instead?
Only this web site has the issue that failed to connect to remote if using an real IP.