static void Main(string[] args) { MasterServer Svr = new MasterServer(); ZNet.StartOption param = new ZNet.StartOption(); param.m_IpAddressListen = ServerP2P_Common.MasterServerConnect.master_ipaddr; param.m_PortListen = ServerP2P_Common.MasterServerConnect.master_portnum; param.m_MaxConnectionCount = 2000; Svr.m_Core.SetKeepAliveOption(60); ZNet.ResultInfo outResult = new ZNet.ResultInfo(); if (Svr.m_Core.Start(param, outResult)) { Console.WriteLine("MasterServer start ok.\n"); DisplayHelpCommand(); } else { Console.WriteLine("Start error : {0} \n", outResult.msg); } var ret = ReadLineAsync(); bool run_program = true; while (run_program) { if (ret.IsCompleted) { switch (ret.Result) { case "/h": DisplayHelpCommand(); break; case "/stat": DisplayStatus(Svr.m_Core); break; case "/q": Console.WriteLine("quit Server..."); run_program = false; break; } if (run_program) { ret = ReadLineAsync(); } } System.Threading.Thread.Sleep(10); } Console.WriteLine("Start Closing... "); Svr.m_Core.Dispose(); Console.WriteLine("Close complete."); System.Threading.Thread.Sleep(1000 * 2); }
public void Start() { // 서비스 시작 파라미터 선언 ZNet.StartOption param = new ZNet.StartOption(); // Listen 주소 설정 param.m_IpAddressListen = "127.0.0.1"; param.m_PortListen = 29999; // c#의 async/await기능을 이용할경우 반드시 0으로 설정 param.m_LogicThreadCount = 0; ZNet.ResultInfo outResult = new ZNet.ResultInfo(); if (net.Start(param, outResult)) { form.Put("service start ok"); } else { form.Put("start failed: {0}", outResult.msg); return; } }
static void Main(string[] args) { MasterServer Svr = new MasterServer(); ZNet.StartOption param = new ZNet.StartOption(); param.m_IpAddressListen = ServerP2P_Common.MasterServerConnect.master_ipaddr; param.m_PortListen = ServerP2P_Common.MasterServerConnect.master_portnum; param.m_MaxConnectionCount = 2000; Svr.m_Core.SetKeepAliveOption(60); ZNet.ResultInfo outResult = new ZNet.ResultInfo(); if (Svr.m_Core.Start(param, outResult)) { Console.WriteLine("MasterServer start ok.\n"); DisplayHelpCommand(); } else { Console.WriteLine("Start error : {0} \n", outResult.msg); } var ret = ReadLineAsync(); bool run_program = true; while (run_program) { if (ret.IsCompleted) { switch (ret.Result) { case "/h": DisplayHelpCommand(); break; case "/stat": DisplayStatus(Svr.m_Core); break; case "/q": Console.WriteLine("quit Server..."); run_program = false; break; } if (run_program) ret = ReadLineAsync(); } System.Threading.Thread.Sleep(10); } Console.WriteLine("Start Closing... "); Svr.m_Core.Dispose(); Console.WriteLine("Close complete."); System.Threading.Thread.Sleep(1000 * 2); }
static void Main(string[] args) { string ipaddr = "127.0.0.1"; UInt16 portnum = 20000; // 로드벨런싱을 위한 여러개의 서버를 실행하기 위해 이 서버의 Listen Port번호를 파라미터로 입력가능 if (args.Length == 1) { portnum = UInt16.Parse(args[0]); } MainServer Svr = new MainServer(); ZNet.StartOption param = new ZNet.StartOption(); param.m_IpAddressListen = ipaddr; param.m_PortListen = portnum; param.m_MaxConnectionCount = 2000; param.m_RefreshServerTickMs = 10000; param.m_ProtocolVersion = ServerP2P_Common.Join.protocol_ver; Svr.m_Core.SetKeepAliveOption(30); ZNet.ResultInfo outResult = new ZNet.ResultInfo(); if (Svr.m_Core.Start(param, outResult)) { Console.WriteLine("MainServer Start ok.\n"); DisplayHelpCommand(); } else { Console.WriteLine("Start error : {0} \n", outResult.msg); } // master client connect Svr.m_Core.MasterConnect( ServerP2P_Common.MasterServerConnect.master_ipaddr, ServerP2P_Common.MasterServerConnect.master_portnum, "MainServer", (int)ServerP2P_Common.Server.Main ); var ret = ReadLineAsync(); bool run_program = true; while (run_program) { if (ret.IsCompleted) { switch (ret.Result) { case "/h": DisplayHelpCommand(); break; case "/stat": DisplayStatus(Svr.m_Core); break; case "/q": Console.WriteLine("quit Server..."); run_program = false; break; } if (run_program) ret = ReadLineAsync(); } System.Threading.Thread.Sleep(10); } Console.WriteLine("Start Closing... "); Svr.m_Core.Dispose(); Console.WriteLine("Close complete."); System.Threading.Thread.Sleep(1000 * 2); }
static void Main(string[] args) { LoginServer Svr = new LoginServer(); ZNet.StartOption param = new ZNet.StartOption(); param.m_IpAddressListen = CasualCommon.Join.ipaddr; param.m_PortListen = CasualCommon.Join.portnum; param.m_MaxConnectionCount = 50000; param.m_RefreshServerTickMs = 10000; param.m_ProtocolVersion = CasualCommon.Join.protocol_ver; Svr.m_Core.SetKeepAliveOption(30); ZNet.ResultInfo outResult = new ZNet.ResultInfo(); if (Svr.m_Core.Start(param, outResult)) { Console.WriteLine("LoginServer Start ok.\n"); CasualCommon.Common.DisplayHelpCommand(); } else { Console.WriteLine("Start error : {0} \n", outResult.msg); } Svr.m_Core.MasterConnect( CasualCommonSvr.MasterServerConnect.master_ipaddr, CasualCommonSvr.MasterServerConnect.master_portnum, "LoginServer", (int)CasualCommon.Server.Login ); var ret = CasualCommon.Common.ReadLineAsync(); while (Svr.run_program) { if (ret.IsCompleted) { switch (ret.Result) { case "/h": CasualCommon.Common.DisplayHelpCommand(); break; case "/stat": CasualCommonSvr.Common.DisplayStatus(Svr.m_Core); break; case "/q": Console.WriteLine("quit Server..."); Svr.run_program = false; break; } if (Svr.run_program) { ret = CasualCommon.Common.ReadLineAsync(); } } System.Threading.Thread.Sleep(10); } Console.WriteLine("Start Closing... "); Svr.m_Core.Dispose(); Console.WriteLine("Close complete."); System.Threading.Thread.Sleep(1000 * 2); }
static void Main(string[] args) { MasterServer Svr = new MasterServer(); ZNet.StartOption param = new ZNet.StartOption(); param.m_IpAddressListen = CasualCommonSvr.MasterServerConnect.master_ipaddr; param.m_PortListen = CasualCommonSvr.MasterServerConnect.master_portnum; param.m_MaxConnectionCount = 5000; Svr.m_Core.SetKeepAliveOption(60); ZNet.ResultInfo outResult = new ZNet.ResultInfo(); if (Svr.m_Core.Start(param, outResult)) { Console.WriteLine("MasterServer start ok.\n"); DisplayHelpCommand(); // 테스트 위해 서버들 자동실행 (로그인1개, 로비2개, 룸서버2개) System.Threading.Thread.Sleep(1000); System.Diagnostics.Process.Start("CasualLogin.exe"); System.Diagnostics.Process.Start("CasualLobby.exe"); //System.Diagnostics.Process.Start("CasualLobby.exe", "22005"); System.Diagnostics.Process.Start("CasualRoom.exe"); //System.Diagnostics.Process.Start("CasualRoom.exe", "25010"); } else { Console.WriteLine("Start error : {0} \n", outResult.msg); } var ret = ReadLineAsync(); bool run_program = true; while (run_program) { if (ret.IsCompleted) { switch (ret.Result) { case "/h": DisplayHelpCommand(); break; case "/stat": CasualCommonSvr.Common.DisplayStatus(Svr.m_Core); break; case "/q": Console.WriteLine("quit Server..."); run_program = false; break; } if (run_program) { ret = ReadLineAsync(); } } System.Threading.Thread.Sleep(10); } Console.WriteLine("Start Closing... "); Svr.m_Core.Dispose(); Console.WriteLine("Close complete."); System.Threading.Thread.Sleep(1000 * 2); }
static void Main(string[] args) { string ipaddr = "127.0.0.1"; UInt16 portnum = 20033; // 로드벨런싱을 위한 여러개의 서버를 실행하기 위해 이 서버의 Listen Port번호를 파라미터로 입력가능 if (args.Length == 1) { portnum = UInt16.Parse(args[0]); } MainServer Svr = new MainServer(); ZNet.StartOption param = new ZNet.StartOption(); param.m_IpAddressListen = ipaddr; param.m_PortListen = portnum; param.m_MaxConnectionCount = 2000; param.m_RefreshServerTickMs = 10000; param.m_ProtocolVersion = ServerP2P_Common.Join.protocol_ver; Svr.m_Core.SetKeepAliveOption(30); ZNet.ResultInfo outResult = new ZNet.ResultInfo(); if (Svr.m_Core.Start(param, outResult)) { Console.WriteLine("MainServer Start ok.\n"); DisplayHelpCommand(); } else { Console.WriteLine("Start error : {0} \n", outResult.msg); } // master client connect : 서버간 P2P통신을 위해 마스터 서버로 접속하는 부분 (접속 성공 이후 자동으로 모든 서버간 P2P연결 활성) Svr.m_Core.MasterConnect( ServerP2P_Common.MasterServerConnect.master_ipaddr, ServerP2P_Common.MasterServerConnect.master_portnum, "MainServer", (int)ServerP2P_Common.Server.Main ); var ret = ReadLineAsync(); bool run_program = true; while (run_program) { if (ret.IsCompleted) { switch (ret.Result) { case "/h": DisplayHelpCommand(); break; case "/stat": DisplayStatus(Svr.m_Core); break; case "/q": Console.WriteLine("quit Server..."); run_program = false; break; } if (run_program) { ret = ReadLineAsync(); } } System.Threading.Thread.Sleep(10); } Console.WriteLine("Start Closing... "); Svr.m_Core.Dispose(); Console.WriteLine("Close complete."); System.Threading.Thread.Sleep(1000 * 2); }
static void Main(string[] args) { UdoServer Svr = new UdoServer(); // udp 관련 옵션 설정을 위해 : StartOption의 디폴트 값을 그대로 사용해도 되지만 세부설정을 위해 별도 선언 ZNet.StartOption op = new ZNet.StartOption(); op.m_UdpPorts = new int[2]; // 서버에서 사용할 udp 포트 개수 op.m_UdpPorts[0] = 20004; // udp 포트 설정 op.m_UdpPorts[1] = 20005; // udp 포트 설정 ZNet.ResultInfo outResult = new ZNet.ResultInfo(); if (Svr.m_Core.Start(op, outResult)) { Console.WriteLine("Start Server ok. ver[{0}.{1:0000}]\n", Svr.m_Core.GetCoreVersion() / 10000, Svr.m_Core.GetCoreVersion() % 10000); Console.WriteLine("/Cmd: q(Quit) h(Help) stat(status info)\n"); } else { Console.WriteLine("Error Start... : {0} \n", outResult.msg); System.Threading.Thread.Sleep(1000 * 4); Svr.m_Core.Dispose(); return; } var ret = ReadLineAsync(); bool run_program = true; while (run_program) { if (ret.IsCompleted) { switch (ret.Result) { case "/h": Console.WriteLine("/Cmd: q(Quit) h(Help) stat(status info)"); break; case "/stat": ZNet.ServerState status; Svr.m_Core.GetCurrentState(out status); Console.WriteLine(string.Format("[NetInfo] Joined Client = {0}\n", status.m_JoinedClient)); break; case "/q": Console.WriteLine("quit Server..."); run_program = false; break; } if (run_program) ret = ReadLineAsync(); } System.Threading.Thread.Sleep(10); } Console.WriteLine("Start Closing... "); Svr.m_Core.Dispose(); Console.WriteLine("Close complete."); System.Threading.Thread.Sleep(1000 * 2); }
static void Main(string[] args) { UInt16 portnum = CasualCommonSvr.Lobby.portnum; // 로드벨런싱을 위한 여러개의 서버를 실행하기 위해 이 서버의 Listen Port번호를 파라미터로 입력가능 if (args.Length == 1) { portnum = UInt16.Parse(args[0]); } LobbyServer Svr = new LobbyServer(); ZNet.StartOption param = new ZNet.StartOption(); param.m_IpAddressListen = CasualCommonSvr.Lobby.ipaddr; param.m_PortListen = portnum; param.m_MaxConnectionCount = 50000; param.m_RefreshServerTickMs = 10000; param.m_ProtocolVersion = CasualCommon.Join.protocol_ver; Svr.m_Core.SetKeepAliveOption(30); ZNet.ResultInfo outResult = new ZNet.ResultInfo(); if (Svr.m_Core.Start(param, outResult)) { Console.WriteLine("LobbyServer Start ok.\n"); DisplayCommand(); } else { Console.WriteLine("Start error : {0} \n", outResult.msg); } Svr.m_Core.MasterConnect( CasualCommonSvr.MasterServerConnect.master_ipaddr, CasualCommonSvr.MasterServerConnect.master_portnum, string.Format("LobbyServer{0}", portnum), (int)CasualCommon.Server.Lobby ); var ret = CasualCommon.Common.ReadLineAsync(); while (Svr.run_program) { if (ret.IsCompleted) { switch (ret.Result) { case "/h": DisplayCommand(); break; case "/stat": CasualCommonSvr.Common.DisplayStatus(Svr.m_Core); break; case "/room": if (Svr.RemoteRooms.Count > 0) { foreach (var obj in Svr.RemoteRooms) { Console.WriteLine("room {0}/{1}", obj.Value.users.Count, obj.Value.max_users); } } else { Console.WriteLine("room empty"); } break; case "/q": Console.WriteLine("quit Server..."); Svr.run_program = false; break; } if (Svr.run_program) ret = CasualCommon.Common.ReadLineAsync(); } System.Threading.Thread.Sleep(10); } Console.WriteLine("Start Closing... "); Svr.m_Core.Dispose(); Console.WriteLine("Close complete."); System.Threading.Thread.Sleep(1000 * 2); }
static void Main(string[] args) { UInt16 portnum = 20000; string ipaddr = "127.0.0.1"; SampleServer Svr = new SampleServer(); ZNet.StartOption param = new ZNet.StartOption(); param.m_IpAddressListen = ipaddr; param.m_PortListen = portnum; // 최대 동접 숫자 설정 param.m_MaxConnectionCount = 5000; // 연결 유지 시간 설정(초단위) Svr.m_Core.SetKeepAliveOption(10); ZNet.ResultInfo outResult = new ZNet.ResultInfo(); if (Svr.m_Core.Start(param, outResult)) { Console.WriteLine("Server Start ok. ver[{0}.{1:0000}]\n", Svr.m_Core.GetCoreVersion() / 10000, Svr.m_Core.GetCoreVersion() % 10000); DisplayHelpCommand(); } else { Console.WriteLine("Start error : {0} \n", outResult.msg); } var ret = ReadLineAsync(); bool run_program = true; while (run_program) { if (ret.IsCompleted) { switch (ret.Result) { case "/h": DisplayHelpCommand(); break; case "/stat": DisplayStatus(Svr.m_Core); break; case "/q": Console.WriteLine("quit Server..."); run_program = false; break; } if (run_program) ret = ReadLineAsync(); } System.Threading.Thread.Sleep(10); } Console.WriteLine("Start Closing... "); Svr.m_Core.Dispose(); Console.WriteLine("Close complete."); System.Threading.Thread.Sleep(1000 * 2); }
protected abstract void BeforeStart(out ZNet.StartOption param);
static void Main(string[] args) { UdoServer Svr = new UdoServer(); // udp 관련 옵션 설정을 위해 : StartOption의 디폴트 값을 그대로 사용해도 되지만 세부설정을 위해 별도 선언 ZNet.StartOption op = new ZNet.StartOption(); op.m_UdpPorts = new int[2]; // 서버에서 사용할 udp 포트 개수 op.m_UdpPorts[0] = 20004; // udp 포트 설정 op.m_UdpPorts[1] = 20005; // udp 포트 설정 ZNet.ResultInfo outResult = new ZNet.ResultInfo(); if (Svr.m_Core.Start(op, outResult)) { Console.WriteLine("Start Server ok. ver[{0}.{1:0000}]\n", Svr.m_Core.GetCoreVersion() / 10000, Svr.m_Core.GetCoreVersion() % 10000); Console.WriteLine("/Cmd: q(Quit) h(Help) stat(status info)\n"); } else { Console.WriteLine("Error Start... : {0} \n", outResult.msg); System.Threading.Thread.Sleep(1000 * 4); Svr.m_Core.Dispose(); return; } var ret = ReadLineAsync(); bool run_program = true; while (run_program) { if (ret.IsCompleted) { switch (ret.Result) { case "/h": Console.WriteLine("/Cmd: q(Quit) h(Help) stat(status info)"); break; case "/stat": ZNet.ServerState status; Svr.m_Core.GetCurrentState(out status); Console.WriteLine(string.Format("[NetInfo] Joined Client = {0}\n", status.m_JoinedClient)); break; case "/q": Console.WriteLine("quit Server..."); run_program = false; break; } if (run_program) { ret = ReadLineAsync(); } } System.Threading.Thread.Sleep(10); } Console.WriteLine("Start Closing... "); Svr.m_Core.Dispose(); Console.WriteLine("Close complete."); System.Threading.Thread.Sleep(1000 * 2); }
static void Main(string[] args) { MasterServer Svr = new MasterServer(); ZNet.StartOption param = new ZNet.StartOption(); param.m_IpAddressListen = CasualCommonSvr.MasterServerConnect.master_ipaddr; param.m_PortListen = CasualCommonSvr.MasterServerConnect.master_portnum; param.m_MaxConnectionCount = 5000; Svr.m_Core.SetKeepAliveOption(60); ZNet.ResultInfo outResult = new ZNet.ResultInfo(); if (Svr.m_Core.Start(param, outResult)) { Console.WriteLine("MasterServer start ok.\n"); DisplayHelpCommand(); // 테스트 위해 서버들 자동실행 (로그인1개, 로비2개, 룸서버2개) System.Threading.Thread.Sleep(1000); System.Diagnostics.Process.Start("CasualLogin.exe"); System.Diagnostics.Process.Start("CasualLobby.exe"); //System.Diagnostics.Process.Start("CasualLobby.exe", "22005"); System.Diagnostics.Process.Start("CasualRoom.exe"); //System.Diagnostics.Process.Start("CasualRoom.exe", "25010"); } else { Console.WriteLine("Start error : {0} \n", outResult.msg); } var ret = ReadLineAsync(); bool run_program = true; while (run_program) { if (ret.IsCompleted) { switch (ret.Result) { case "/h": DisplayHelpCommand(); break; case "/stat": CasualCommonSvr.Common.DisplayStatus(Svr.m_Core); break; case "/q": Console.WriteLine("quit Server..."); run_program = false; break; } if (run_program) ret = ReadLineAsync(); } System.Threading.Thread.Sleep(10); } Console.WriteLine("Start Closing... "); Svr.m_Core.Dispose(); Console.WriteLine("Close complete."); System.Threading.Thread.Sleep(1000 * 2); }
static void Main(string[] args) { UInt16 portnum = CasualCommonSvr.Lobby.portnum; // 로드벨런싱을 위한 여러개의 서버를 실행하기 위해 이 서버의 Listen Port번호를 파라미터로 입력가능 if (args.Length == 1) { portnum = UInt16.Parse(args[0]); } LobbyServer Svr = new LobbyServer(); ZNet.StartOption param = new ZNet.StartOption(); param.m_IpAddressListen = CasualCommonSvr.Lobby.ipaddr; param.m_PortListen = portnum; param.m_MaxConnectionCount = 50000; param.m_RefreshServerTickMs = 10000; param.m_ProtocolVersion = CasualCommon.Join.protocol_ver; Svr.m_Core.SetKeepAliveOption(30); ZNet.ResultInfo outResult = new ZNet.ResultInfo(); if (Svr.m_Core.Start(param, outResult)) { Console.WriteLine("LobbyServer Start ok.\n"); DisplayCommand(); } else { Console.WriteLine("Start error : {0} \n", outResult.msg); } Svr.m_Core.MasterConnect( CasualCommonSvr.MasterServerConnect.master_ipaddr, CasualCommonSvr.MasterServerConnect.master_portnum, string.Format("LobbyServer{0}", portnum), (int)CasualCommon.Server.Lobby ); var ret = CasualCommon.Common.ReadLineAsync(); while (Svr.run_program) { if (ret.IsCompleted) { switch (ret.Result) { case "/h": DisplayCommand(); break; case "/stat": CasualCommonSvr.Common.DisplayStatus(Svr.m_Core); break; case "/room": if (Svr.RemoteRooms.Count > 0) { foreach (var obj in Svr.RemoteRooms) { Console.WriteLine("room {0}/{1}", obj.Value.users.Count, obj.Value.max_users); } } else { Console.WriteLine("room empty"); } break; case "/q": Console.WriteLine("quit Server..."); Svr.run_program = false; break; } if (Svr.run_program) { ret = CasualCommon.Common.ReadLineAsync(); } } System.Threading.Thread.Sleep(10); } Console.WriteLine("Start Closing... "); Svr.m_Core.Dispose(); Console.WriteLine("Close complete."); System.Threading.Thread.Sleep(1000 * 2); }
static void Main(string[] args) { UInt16 portnum = 20000; string ipaddr = "127.0.0.1"; SampleServer Svr = new SampleServer(); ZNet.StartOption param = new ZNet.StartOption(); param.m_IpAddressListen = ipaddr; param.m_PortListen = portnum; // 최대 동접 숫자 설정 param.m_MaxConnectionCount = 5000; // 연결 유지 시간 설정(초단위) Svr.m_Core.SetKeepAliveOption(10); ZNet.ResultInfo outResult = new ZNet.ResultInfo(); if (Svr.m_Core.Start(param, outResult)) { Console.WriteLine("Server Start ok. ver[{0}.{1:0000}]\n", Svr.m_Core.GetCoreVersion() / 10000, Svr.m_Core.GetCoreVersion() % 10000); DisplayHelpCommand(); } else { Console.WriteLine("Start error : {0} \n", outResult.msg); } var ret = ReadLineAsync(); bool run_program = true; while (run_program) { if (ret.IsCompleted) { switch (ret.Result) { case "/h": DisplayHelpCommand(); break; case "/stat": DisplayStatus(Svr.m_Core); break; case "/q": Console.WriteLine("quit Server..."); run_program = false; break; } if (run_program) { ret = ReadLineAsync(); } } System.Threading.Thread.Sleep(10); } Console.WriteLine("Start Closing... "); Svr.m_Core.Dispose(); Console.WriteLine("Close complete."); System.Threading.Thread.Sleep(1000 * 2); }
static void Main(string[] args) { LoginServer Svr = new LoginServer(); ZNet.StartOption param = new ZNet.StartOption(); param.m_IpAddressListen = ServerP2P_Common.Join.ipaddr; param.m_PortListen = ServerP2P_Common.Join.portnum; param.m_MaxConnectionCount = 2000; param.m_RefreshServerTickMs = 10000; param.m_ProtocolVersion = ServerP2P_Common.Join.protocol_ver; Svr.m_Core.SetKeepAliveOption(30); ZNet.ResultInfo outResult = new ZNet.ResultInfo(); if (Svr.m_Core.Start(param, outResult)) { Console.WriteLine("LoginServer Start ok.\n"); DisplayHelpCommand(); } else { Console.WriteLine("Start error : {0} \n", outResult.msg); } // master client connect : 서버간 P2P통신을 위해 마스터 서버로 접속하는 부분 (접속 성공 이후 자동으로 모든 서버간 P2P연결 활성) Svr.m_Core.MasterConnect( ServerP2P_Common.MasterServerConnect.master_ipaddr, ServerP2P_Common.MasterServerConnect.master_portnum, "LoginServer", (int)ServerP2P_Common.Server.Login ); var ret = ReadLineAsync(); bool run_program = true; while (run_program) { if (ret.IsCompleted) { switch (ret.Result) { case "/h": DisplayHelpCommand(); break; case "/stat": DisplayStatus(Svr.m_Core); break; case "/s": // 현시점에서 가장 원활한 Main 서버 정보를 출력해보기 : 서버이동시 선택될 확률이 가장 높은 서버 ZNet.MasterInfo selectSvr; if (Svr.m_Core.SelectServer((int)ServerP2P_Common.Server.Main, out selectSvr)) { Console.WriteLine("select svr {0} {1}", (ServerP2P_Common.Server)selectSvr.m_ServerType, selectSvr.m_Addr.m_port); } else { Console.WriteLine("select svr empty"); } break; case "/q": Console.WriteLine("quit Server..."); run_program = false; break; } if (run_program) ret = ReadLineAsync(); } System.Threading.Thread.Sleep(10); } Console.WriteLine("Start Closing... "); Svr.m_Core.Dispose(); Console.WriteLine("Close complete."); System.Threading.Thread.Sleep(1000 * 2); }
static void Main(string[] args) { LoginServer Svr = new LoginServer(); ZNet.StartOption param = new ZNet.StartOption(); param.m_IpAddressListen = CasualCommon.Join.ipaddr; param.m_PortListen = CasualCommon.Join.portnum; param.m_MaxConnectionCount = 50000; param.m_RefreshServerTickMs = 10000; param.m_ProtocolVersion = CasualCommon.Join.protocol_ver; Svr.m_Core.SetKeepAliveOption(30); ZNet.ResultInfo outResult = new ZNet.ResultInfo(); if (Svr.m_Core.Start(param, outResult)) { Console.WriteLine("LoginServer Start ok.\n"); CasualCommon.Common.DisplayHelpCommand(); } else { Console.WriteLine("Start error : {0} \n", outResult.msg); } Svr.m_Core.MasterConnect( CasualCommonSvr.MasterServerConnect.master_ipaddr, CasualCommonSvr.MasterServerConnect.master_portnum, "LoginServer", (int)CasualCommon.Server.Login ); var ret = CasualCommon.Common.ReadLineAsync(); while (Svr.run_program) { if (ret.IsCompleted) { switch (ret.Result) { case "/h": CasualCommon.Common.DisplayHelpCommand(); break; case "/stat": CasualCommonSvr.Common.DisplayStatus(Svr.m_Core); break; case "/q": Console.WriteLine("quit Server..."); Svr.run_program = false; break; } if (Svr.run_program) ret = CasualCommon.Common.ReadLineAsync(); } System.Threading.Thread.Sleep(10); } Console.WriteLine("Start Closing... "); Svr.m_Core.Dispose(); Console.WriteLine("Close complete."); System.Threading.Thread.Sleep(1000 * 2); }