As Jesse says, don't use ListenAndServe if you want be certain
of connecting to a newly started server.
listener, err := net.Listen("tcp", ":8080")
if err != nil { .... }
go http.Serve(listener, nil)
// now you can connect to the server without risk that it's not up.
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
golang-nuts...@googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.