草庐IT

localAddress

全部标签

http - 如何在 GO 中获取 LocalAddress?

我在go中制作了一个充当代理的网络服务器。我需要获取有关客户的信息才能做出回应。这是我的代码:funcmain(){li,err:=net.Listen("tcp",":8000")iferr!=nil{log.Fatalln(err.Error())}deferli.Close()for{conn,err:=li.Accept()iferr!=nil{log.Fatalln(err.Error())}local:=conn.LocalAddrremote:=conn.RemoteAddrfmt.Println(string(local.Network))fmt.Println(str

scala - Akka 关闭 TCP actor

在下面的代码中GSMmockunbound永远不会记录,即使“禁用”消息已发送到服务器。如何正确解除绑定(bind)akkatcp服务器?classGsmRouterextendsActor{importTcp._importcontext.systemvalname=this.getClass().getName()vallogger=LoggerFactory.getLogger(name)defreceive={case"enable"=>IO(Tcp)!Bind(self,ConfigurationUtils.gsmRouterAddress)case"disable"=>IO