Ejemplo n.º 1
0
        private static void Main()
        {
            var sh = new WebSocketsHost <ChatService>(new Uri("ws://" + Environment.MachineName + ":4502/chat"));

            sh.AddWebSocketsEndpoint();
            sh.Open();

            Console.WriteLine("Websocket chat server listening on " + sh.Description.Endpoints[0].Address.Uri.AbsoluteUri);
            Console.WriteLine();

            Console.ForegroundColor = ConsoleColor.Yellow;

            Console.WriteLine("NOTE:");
            Console.WriteLine("1. Validate http://localhost/clientaccesspolicy.xml is accessible from the browser before running the chat client.");
            Console.WriteLine("   (See detailed instructions in clientaccesspolicy.xml in the ChatService project.)");
            Console.WriteLine("2. Ensure the firewall allows incoming TCP traffic on port 4502 before running the chat client.");

            Console.ResetColor();

            Console.WriteLine();
            Console.WriteLine("Press Ctrl-C to terminate the chat server...");

            using (ManualResetEvent manualResetEvent = new ManualResetEvent(false))
            {
                manualResetEvent.WaitOne();
            }

            sh.Close();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes the gameService.
        /// </summary>
        private static void Main()
        {
            string appName = ConfigurationManager.AppSettings["AppName"];
            string portNumber = ConfigurationManager.AppSettings["PortNumber"];
            string machineName = ConfigurationManager.AppSettings["MachineName"];
            string uriString = machineName + ":" + portNumber + "/" + appName;

            var sh = new WebSocketsHost<GameService>(new Uri("ws://" + uriString));
            sh.AddWebSocketsEndpoint();
            sh.Open();

            Console.WriteLine("Websocket game server listening on " + sh.Description.Endpoints[0].Address.Uri.AbsoluteUri);
            Console.WriteLine();

            Console.ForegroundColor = ConsoleColor.Yellow;

            Console.WriteLine("NOTE:");
            Console.WriteLine("1. Validate http://localhost/clientaccesspolicy.xml is accessible from the browser before running the game client.");
            Console.WriteLine("   (See detailed instructions in clientaccesspolicy.xml in the GameService project.)");
            Console.WriteLine("2. Ensure the firewall allows incoming TCP traffic on port 4502 before running the game client.");

            Console.ResetColor();

            Console.WriteLine();
            Console.WriteLine("Press Ctrl-C to terminate the game server...");

            using (ManualResetEvent manualResetEvent = new ManualResetEvent(false))
            {
                manualResetEvent.WaitOne();
            }

            sh.Close();
        }
Ejemplo n.º 3
0
        private static void Main()
        {
            var sh = new WebSocketsHost<EchoService>(new Uri("ws://" + Environment.MachineName + ":4502/echo"));
            sh.AddWebSocketsEndpoint();
            sh.Open();

            Console.WriteLine("Websocket echo server listening on " + sh.Description.Endpoints[0].Address.Uri.AbsoluteUri);
            Console.WriteLine();

            Console.ForegroundColor = ConsoleColor.Yellow;

            Console.WriteLine("NOTE:");
            Console.WriteLine("1. Validate http://localhost/clientaccesspolicy.xml is accessible from the browser before running the echo client.");
            Console.WriteLine("   (See detailed instructions in clientaccesspolicy.xml in the EchoService project.)");
            Console.WriteLine("2. Ensure the firewall allows incoming TCP traffic on port 4502 before running the echo client.");

            Console.ResetColor();

            Console.WriteLine();
            Console.WriteLine("Press Ctrl-C to terminate the echo server...");

            using (ManualResetEvent manualResetEvent = new ManualResetEvent(false))
            {
                manualResetEvent.WaitOne();
            }

            sh.Close();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes the gameService.
        /// </summary>
        private static void Main()
        {
            string appName     = ConfigurationManager.AppSettings["AppName"];
            string portNumber  = ConfigurationManager.AppSettings["PortNumber"];
            string machineName = ConfigurationManager.AppSettings["MachineName"];
            string uriString   = machineName + ":" + portNumber + "/" + appName;

            var sh = new WebSocketsHost <GameService>(new Uri("ws://" + uriString));

            sh.AddWebSocketsEndpoint();
            sh.Open();

            Console.WriteLine("Websocket game server listening on " + sh.Description.Endpoints[0].Address.Uri.AbsoluteUri);
            Console.WriteLine();

            Console.ForegroundColor = ConsoleColor.Yellow;

            Console.WriteLine("NOTE:");
            Console.WriteLine("1. Validate http://localhost/clientaccesspolicy.xml is accessible from the browser before running the game client.");
            Console.WriteLine("   (See detailed instructions in clientaccesspolicy.xml in the GameService project.)");
            Console.WriteLine("2. Ensure the firewall allows incoming TCP traffic on port 4502 before running the game client.");

            Console.ResetColor();

            Console.WriteLine();
            Console.WriteLine("Press Ctrl-C to terminate the game server...");

            using (ManualResetEvent manualResetEvent = new ManualResetEvent(false))
            {
                manualResetEvent.WaitOne();
            }

            sh.Close();
        }