You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've searched for a solution to this issue, but I couldn't find anything obviously
relevant.
What steps will reproduce the problem?
1. Please see code at http://play.golang.org/p/KyVr28Tw-K
2. Build go 1.0.3 from source with CGO_ENABLED=0
3. go build the program referenced in (1) above.
4. go install it, then copy to a CentOS 5.8 machine.
5. Execute it with bin/whatever.
6. In another console, type "netstat -nlp" to view listening sockets.
7. Observe that the program only waits on :::80, but not on 0.0.0.0:80 or on *:80.
8. Execute curl -X GET "http://ipv4.address.of.server:8080/";
9. Observe no connection is possible.
10. Execute curl -X GET "http://ipv6.address.of.server:8080/";
11. Observe connection works as expected.
What is the expected output?
I don't have any problems with net/http binding to one network protocol at a time; I can
always launch multiple goroutines for each supported network. However, the code linked
above is pretty clearly configured to bind to an IPv4 endpoint, not to an IPv6 endpoint
(observe lack of [::]:8080 in the address string).
What do you see instead?
It binds to IPv6 endpoint no matter what, which causes connections to be rejected by my
cloud server, wherein I cannot turn off IPv6 support (I tried everything I knew how, and
then some).
Which compiler are you using (5g, 6g, 8g, gccgo)?
6g
Which operating system are you using?
On Ubuntu 12, it behaves well, as the kernel apparently treats a binding to :::8080 the
same as *:8080. On CentOS 5.8 (see additional info below), I fail to connect when using
IPv4 addresses.
Which version are you using? (run 'go version')
go1.0.3
Please provide any additional information below.
Yes, I know CentOS 5.8 isn't supported, but that's what my cloud server is running;
upgrading isn't possible, as the purpose of the code is to perform tests of another
program on an OS configuration that our customers continue using. Since I have 13
different OS configs to check on, I figured using Go would be ideal since I can just
splat the static binary to all 13 machines at once and be off and running.
I think the long-term solution for this would be to somehow extend the Server struct
with a set of optional fields to help control which network the server should listen on.
E.g., the following would be ideal:
s := &http.Server{
Addr: ":8080",
AddrType: net.TCP4,
// etc...
}
The text was updated successfully, but these errors were encountered:
You need to create a net.Listener separately. The http package's ListenAndServe
functions are for convenience, and are not a complete solution.
http://play.golang.org/p/EOZkK1UUpe
by sam.falvo:
The text was updated successfully, but these errors were encountered: