According to you, I think it's a little more flexible way for users.
Do you think of adding a pair of new methods for setter/getter of
this?
On Jul 16, 10:18 am, smallfish <
smallfish...@gmail.com> wrote:
> Hi, all
>
> I wrote some http server example, find default server run with tcp6. so
> visit the ipv6 address with some problem.
>
> because i disable the ipv6 :(
>
> also can mody the src/pkg/http/server.go source, change net.Listen("tcp",
> addr) -> net.Listen("tcp4", addr).
>
> but it's a not good idea. can add declare a variable with tcp/tcp4/tcp6
> etc...
>
> CODE:
> // ----------------------------------------------------------
> *var ServeType = "tcp"*
> *func ListenAndServe(addr string, handler Handler) os.Error {*
> * l, e := net.Listen(ServeType, addr)*
> // ----------------------------------------------------------
>
> APP CODE(old code don't need to mody, default is tcp):
> // ----------------------------------------------------------
> * http.ServeType = "tcp4"*
> * err := http.ListenAndServe(":8080", nil)*