static void Main(string[] args) { CClient Client = new CClient(); Client.m_Core.Connect( "127.0.0.1", 20000, 0, // protocol version 55, // udp recve port : if 0 = disable false, // mobile optimize option true //false // enable auto connection recovery mode ); Console.Write("> "); var ret = ReadLineAsync(); bool run_program = true; while (run_program) { if (ret.IsCompleted) { switch (ret.Result) { case "/q": // leave from server Client.m_Core.Leave(); break; case "/c": Console.WriteLine("reconnect try..."); if (Client.m_Core.ReConnect() == false) { Console.WriteLine("reconnect fail. check connection not disconnect or recovery mode"); } break; case "/exit": run_program = false; break; case "/h": DisplayHelpCommand(); break; case "/f": Client.m_Core.FastRecovery(); // 즉시 연결복구 처리하기 break; case "/k": Client.m_Core.ForceLeave(); // 일방적인 서버와의 연결종료 break; default: // packet send test RemoteClass.CUserClass _testClass = new RemoteClass.CUserClass(); Dictionary <Int32, Int32> _testDic = new Dictionary <Int32, Int32>(); _testDic.Add(1212345, 1230); Client.proxy.request_message(ZNet.RemoteID.Remote_Server, ZNet.CPackOption.Encrypt, _testClass, _testDic, ret.Result); Client.stub.reponse_message = (ZNet.RemoteID remote, ZNet.CPackOption pkOption, RemoteClass.CUserClass testClass, Dictionary <Int32, Int32> dic_test, string msg) => { Console.WriteLine(string.Format("recv : {0}", msg)); return(true); }; break; } if (run_program) { ret = ReadLineAsync(); } } Client.m_Core.NetLoop(); System.Threading.Thread.Sleep(1); } Client.m_Core.Destroy(); System.Threading.Thread.Sleep(1000 * 2); }
static void Main(string[] args) { CClient Client = new CClient(); Client.m_Core.Connect( "127.0.0.1", 20000, 0, // protocol version 55, // udp recve port : if 0 = disable false, // mobile optimize option true//false // enable auto connection recovery mode ); Console.Write("> "); var ret = ReadLineAsync(); bool run_program = true; while (run_program) { if (ret.IsCompleted) { switch (ret.Result) { case "/q": // leave from server Client.m_Core.Leave(); break; case "/c": Console.WriteLine("reconnect try..."); if (Client.m_Core.ReConnect() == false) { Console.WriteLine("reconnect fail. check connection not disconnect or recovery mode"); } break; case "/exit": run_program = false; break; case "/h": DisplayHelpCommand(); break; case "/f": Client.m_Core.FastRecovery(); // 즉시 연결복구 처리하기 break; case "/k": Client.m_Core.ForceLeave(); // 일방적인 서버와의 연결종료 break; default: // packet send test RemoteClass.CUserClass _testClass = new RemoteClass.CUserClass(); Dictionary<Int32, Int32> _testDic = new Dictionary<Int32, Int32>(); _testDic.Add(1212345, 1230); Client.proxy.request_message(ZNet.RemoteID.Remote_Server, ZNet.CPackOption.Encrypt, _testClass, _testDic, ret.Result); Client.stub.reponse_message = (ZNet.RemoteID remote, ZNet.CPackOption pkOption, RemoteClass.CUserClass testClass, Dictionary<Int32, Int32> dic_test, string msg) => { Console.WriteLine(string.Format("recv : {0}", msg)); return true; }; break; } if (run_program) ret = ReadLineAsync(); } Client.m_Core.NetLoop(); System.Threading.Thread.Sleep(1); } Client.m_Core.Destroy(); System.Threading.Thread.Sleep(1000 * 2); }