示例#1
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();
        }
示例#2
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();
        }
示例#3
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();
        }
示例#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();
        }
        static void Main(string[] args)
        {
            var host = new WebSocketsHost<ReverseService>();
            host.AddWebSocketsEndpoint("ws://localhost:4503/reverse");
            host.Open();

            Console.ReadLine();
        }
示例#6
0
 static void Main(string[] args)
 {
     var host = new WebSocketsHost<ReverseService>();
     host.AddWebSocketsEndpoint("ws://void:9999/reverse");
     host.Open();
     Console.WriteLine("The reverse service is now hosted as a Web Sockets service.");
     Console.ReadLine();
 }
        static void Main(string[] args)
        {
            var host = new WebSocketsHost <ReverseService>();

            host.AddWebSocketsEndpoint("ws://localhost:4503/reverse");
            host.Open();

            Console.ReadLine();
        }
        public override void Run()
        {
            RoleInstanceEndpoint exEndPoint =
                RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["NotifyService"];
            // 注 : development fabric では IPEndpoint.Port が fix しないため、4503 に固定 !
            string address = String.Format("ws://{0}/notify", exEndPoint.IPEndpoint);
            //string address = String.Format("ws://{0}:4503/notify", exEndPoint.IPEndpoint.Address);
            WebSocketsHost<MyNotifyService> sh =
                new WebSocketsHost<MyNotifyService>(new Uri(address));
            sh.AddWebSocketsEndpoint();
            sh.Open();

            while (true)
            {
                Thread.Sleep(10000);
                Trace.WriteLine("Working", "Information");
            }
        }
 protected void Application_Start(object sender, EventArgs e)
 {
     host = new WebSocketsHost<MonitoringService>();
     host.AddWebSocketsEndpoint("ws://localhost:4502/monitoring");
     host.Open();
 }