public static void Main() { var _client = new client.client(123456); _client.modulemanager.add_module("ccallh", new ccallh()); _client.modulemanager.add_module("hcallc", new hcallc_module()); if (_client.connect_server("127.0.0.1", 3236)) { _client.onConnectGate += () => { _client.connect_hub("hub_server"); _client.connect_hub("hub_server0"); }; List <string> hubs = new List <string>(); _client.onConnectHub += (string hub_name) => { hubs.Add(hub_name); if (hubs.Contains("hub_server") && hubs.Contains("hub_server0")) { _client.call_hub("hub_server", "ccallh", "ccallh", System.Guid.NewGuid().ToString()); } }; } while (true) { if (_client.poll() < 50) { System.Threading.Thread.Sleep(5); } } }
public static void Main() { var _client = new client.client(123456); var ccallh_handle = new req.ccallh(_client); var hcallc_handle = new imp.hcallc_module(_client); hcallc_handle.onhcallc += (string text) => { Console.WriteLine(text); }; if (_client.connect_server("127.0.0.1", 3236)) { _client.onConnectGate += () => { _client.connect_hub("hub_server"); _client.connect_hub("hub_server0"); }; List <string> hubs = new List <string>(); _client.onConnectHub += (string hub_name) => { hubs.Add(hub_name); if (hubs.Contains("hub_server") && hubs.Contains("hub_server0")) { ccallh_handle.get_hub("hub_server").ccallh().callBack((string text) => { Console.WriteLine(text); }, () => { Console.WriteLine("error"); }); } }; } while (true) { if (_client.poll() < 50) { System.Threading.Thread.Sleep(5); } } }
public void Update() { Int64 tmptick = (Environment.TickCount & UInt32.MaxValue); if (tmptick < _tick) { _tickcount += 1; tmptick = tmptick + _tickcount * UInt32.MaxValue; } _tick = tmptick; try { _client.poll(); // Debug.Log(_tick+"TINK"); } catch (Exception e) { EventDispatcher.GetInstance().UIFrameWorkEventManager.TriggerEvent <string>(EventId.UIFrameWork_Bug, e.Message); } tmptick = (Environment.TickCount & UInt32.MaxValue); if (tmptick < _tick) { _tickcount += 1; tmptick = tmptick + _tickcount * UInt32.MaxValue; } Int64 ticktime = (tmptick - _tick); _tick = tmptick; if (ticktime < 50) { Thread.Sleep(15); } }