Closed dashengli closed 2 years ago
I believe it's not a good idea to get server address from tag
.
When kitex call Register
to register an instance, the real address which server bind would be set in registry.Info.Addr
, check https://github.com/cloudwego/kitex/blob/157c1c6813c0c66a5360f2ff7fec190470693071/server/server.go#L380
Could you describe the step to reproduce the problem of "client can't connect to [::]:8999 or 127.0.0.1:8999
"
(Maybe forgot to use --network host
or -p 8999:8999
when run docker ?)
[::]:8999 or 127.0.0.1:8999
"
First sorry port 8999 to 8877.
Like this:
address := fmt.Sprintf("%s:%d", "0.0.0.0", 8877)
addr, _ := net.ResolveTCPAddr("tcp", address)
opts := []server.Option{
server.WithServerBasicInfo(&rpcinfo.EndpointBasicInfo{ServiceName: "sName"}), //server name
server.WithServiceAddr(addr),
server.WithRegistry(r), // registry
Other computers can connect this server by `192.168.1.11:8877`
I think register address is
![image](https://user-images.githubusercontent.com/22268505/157174923-4cddde79-cadd-400b-9598-3960edd8e5cf.png)
not
![image](https://user-images.githubusercontent.com/22268505/157174564-60ef9dd5-5b6b-4851-9fc8-d8b03d45ed78.png)
This doesn't seem to be a problem with the framework [registry-etcd](https://github.com/kitex-contrib/registry-etcd/issues/5).
This seems to be my own network design problem.
Is your feature request related to a problem? Please describe.
in docker , server use net.Addr with (0.0.0.0:8999) or (127.0.0.1:8999)
client can't to connect
[::]:8999 or 127.0.0.1:8999
Describe the solution you'd like