public async Task <bool> GetAge() { try { LemonClient client = new LemonClient("127.0.0.1", 4506, new JsonSerialize()); string lampList = await client.Request <string>("TestController/GetAge", "haili", 35); Console.WriteLine("back:" + lampList); } catch (Exception ex) { Console.WriteLine("error:" + ex.Message); } return(true); }
public async void GetName() { LemonClient client = new LemonClient("60.205.210.198", 4050, new JsonSerialize()); List <ELamp> lampList = await client.Request <List <ELamp> >("LampService/ListLmapByConcentrator", "concentrator1"); Console.WriteLine("back:"); //ClientConnect client = new ClientConnect(); //client.OnConnectEvent = c => //{ // Console.WriteLine("连接到了服务器"); //}; //client.OnDisconnectEvent = c => //{ // Console.WriteLine("和服务器的连接断开了"); //}; //bool ok = await client.Connect<LemonMessage>("127.0.0.1", 4506, true); //if (ok) // Console.WriteLine("back:"); }
public async Task <string> Test() { LemonClient client = new LemonClient("127.0.0.1", 8090, new JsonSerialize()); return(await client.Request <string>("AccountService/Test", "haili")); }