public static void Main(string[] args) { IPresenter p = new MyPresenter(); IModel m = new MyModel(p); IView v = new MyView(p); p.SetView(v); p.SetModel(m); v.DoConnections(); /*string portStr = ConfigurationManager.AppSettings ["port number"]; * //string portStr = File.ReadAllText (@"/home/caleb/Desktop/app.config"); * int port = Int32.Parse (portStr); * try { * IPEndPoint ipep = new IPEndPoint(IPAddress.Any, port); * using (Socket newsock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) * { * newsock.Bind(ipep); * newsock.Listen(10); * while (true) { * Socket client = newsock.Accept(); * ClientHandler handler = new ClientHandler(client); * //handler.MakeOptions (); * //ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(handler.handle)); * Thread t = new Thread(h GFDGF andler.handle); * t.Start(); * } * } * } * catch (Exception e) { * Console.WriteLine ("Server error" + e.StackTrace); * } */ }
/// <summary> /// The server's main method. It creates the model, presenter, and view and tells the view to /// start handling connections with clients. It also sets the dimensions of all mazes made in /// this program. /// </summary> /// <param name="args"></param> public static void Main(string[] args) { string lenStr = ConfigurationManager.AppSettings["maze length"]; string heightStr = ConfigurationManager.AppSettings["maze height"]; int height = Int32.Parse(heightStr); int len = Int32.Parse(lenStr); Mazes.MazeProgram.ConfigureDimensions(height, len); IPresenter p = new MyPresenter(); IModel m = new MyModel(p); IView v = new MyView(p); p.SetView(v); p.SetModel(m); v.DoConnections(); // Connect with clients }