示例#1
0
        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 cb_ccallh_func ccallh()
        {
            var uuid = System.Guid.NewGuid().ToString();

            client_handle.call_hub(hub_name, "ccallh", "ccallh", uuid);

            var cb_ccallh_obj = new cb_ccallh_func();

            cb_ccallh_handle.map_ccallh.Add(uuid, cb_ccallh_obj);

            return(cb_ccallh_obj);
        }