public T GetService <T>(string hostName, string ip, int port) where T : ActorRef { var refTypeName = typeof(T).Name; string name = refTypeName.Substring(0, refTypeName.Length - 3); IPEndPoint ep = new IPEndPoint(IPAddress.Parse(ip), port); return((T)Global.GetActorRefByAddr(typeof(T), ep, hostName, name, null, Global.Host)); }
//public T GetService<T>(string hostName, string ip, int port) where T : ActorRef //{ // var refTypeName = typeof(T).Name; // string name = refTypeName.Substring(0, refTypeName.Length - 3); // IPEndPoint ep = new IPEndPoint(IPAddress.Parse(ip), port); // return (T)Global.GetActorRefByAddr(typeof(T), ep, hostName, name, null, Global.Host); //} public ActorRef GetHost(string hostName, string ip, int port) { string _ip = ip; if (_ip == "0.0.0.0" || _ip == "127.0.0.1") { _ip = Basic.GetLocalIPv4(System.Net.NetworkInformation.NetworkInterfaceType.Ethernet); } IPEndPoint ep = new IPEndPoint(IPAddress.Parse(_ip), port); return(Global.GetActorRefByAddr(typeof(ActorRef), ep, hostName, "", null, Global.Host)); }
//public T GetService<T>(string hostName, string ip, int port) where T : ActorRef //{ // var refTypeName = typeof(T).Name; // string name = refTypeName.Substring(0, refTypeName.Length - 3); // IPEndPoint ep = new IPEndPoint(IPAddress.Parse(ip), port); // return (T)Global.GetActorRefByAddr(typeof(T), ep, hostName, name, null, Global.Host); //} public ActorRef GetHost(string hostName, string ip, int port) { IPEndPoint ep = new IPEndPoint(IPAddress.Parse(ip), port); return(Global.GetActorRefByAddr(typeof(ActorRef), ep, hostName, "", null, Global.Host)); }