public static async Task Main(string[] args) { RestaurantManager restaurantManager = new RestaurantManager(); restaurantManager.AddSampleData(); XmlSerializer xmlSerializer = new XmlSerializer(restaurantManager.GetType()); RestaurantManager restaurant = new RestaurantManager(); restaurant.AddSampleData(); API api = new API(restaurant); int port; if (args.Length > 0) { port = Int32.Parse(args[0]); } else { TcpListener l = new TcpListener(IPAddress.Loopback, 0); l.Start(); port = ((IPEndPoint)l.LocalEndpoint).Port; l.Stop(); port = 51359; } Console.WriteLine("Port: " + port); Action <WebSocketConnection> action = api.HandleConnectedClient; WebSocketServer.Server(port, action); while (!finish) { } }