static void Main(string[] args) { client = new XRPCClient("127.0.0.1", 9090); client.Connect(); client.NetError = (c, e) => { Console.WriteLine(e.Error.Message); }; client.TimeOut = 10000; Hello(); System.Threading.Thread.Sleep(-1); }
static void Main(string[] args) { client = new XRPCClient("localhost", 9090); client.Connect(); client.NetError = (c, e) => { Console.WriteLine(e.Error.Message); }; client.TimeOut = 10000; Test(); Console.Read(); }
static void Main(string[] args) { client = new XRPCClient("192.168.2.18", 9090, 2); client.Connect(); client.NetError = (c, e) => { Console.WriteLine(e.Error.Message); }; client.TimeOut = 10000; UserService = client.Create <IUserService>(); Test(); Console.Read(); }
/// <summary> /// 注册XRPC服务 /// </summary> /// <param name="services"></param> /// <returns></returns> public static IServiceCollection AddXRPCClient(this IServiceCollection services, IConfiguration configuration) { var hosts = configuration.GetSection("XRPCClient").Value; var timeOut = configuration.GetSection("XRPCClientTimeOut").Value; var arr = hosts.Split(";").ToList(); KetamaNodeLocator ketamaNodeLocator = new KetamaNodeLocator(arr); var host = ketamaNodeLocator.GetPrimary(Guid.NewGuid().ToString()); var client = new XRPCClient(host.Split(":")[0], Convert.ToInt32(host.Split(":")[1])); client.TimeOut = Convert.ToInt32(timeOut); client.Connect(); client.NetError = (c, e) => { Console.WriteLine(e.Error.Message); }; services.AddSingleton(client); return(services); }
static async Task Main(string[] args) { Console.WriteLine("Hello World!"); Random random = new Random(); _client = new XRPCClient("127.0.0.1", 9090); _client.TimeOut = 10000; _client.Connect(); _client.NetError = (c, e) => { Console.WriteLine(e.Error.Message); }; var service = _client.Create <IHelloWorld>(); while (true) { var result = await service.Hello(); Console.WriteLine(result + " " + DateTime.Now.ToString("s")); Thread.Sleep(random.Next(100)); } Console.ReadKey(); }
static XRPCHandler() { Client = new XRPCClient(Setting.SERVER_HOST, 50052, 3); Client.Connect(); Greeter = Client.Create <XRPCModule.IGreeter>(); }
public XRPCHandler() { Client = new XRPCClient("192.168.2.19", 9013, 3); Client.Connect(); UserService = Client.Create <IUserService>(); }
public XRPCHandler() { Client = new XRPCClient("192.168.2.19", 50052, 3); Client.Connect(); Greeter = Client.Create <XRPCModule.IGreeter>(); }