public void Init() { serverPresenter = ServerPresenter.getInstance(); listener = new TcpListener(ipEndPoint); listener.Start(); new Thread(async delegate() { while (index < playerCount) { clients[index] = await listener.AcceptSocketAsync(); Connected(index); index++; } }).Start(); }
static void Main(string[] args) { try { int port = int.Parse(args[0]); int count = int.Parse(args[1]); Console.WriteLine(args[0] + " " + args[1]); ServerPresenter.getInstance().Init(port, count); GamePresenter.getInstance().Init(count); while (!isEnd) { Thread.Sleep(100); } } catch (Exception) { throw; } }