Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.Title = typeof(Program).Namespace;

            // 用于提供静态html页面,也可以用IIS
            var httpServer = new HttpServer();

            httpServer.StartListen(82);
            Console.WriteLine("http服务启动成功 ..");

            // 当浏览器不支持websocket时,将由flash实现
            var flexPolicyServer = new FlexPolicyServer();

            flexPolicyServer.StartListen();
            Console.WriteLine("flex策略服务启动成功 ..");

            // websocket服务
            var webSocketServer = new ChatWebSocketServer();

            webSocketServer.StartListen(83);
            Console.WriteLine("WebSocket服务启动成功 ..");


            // 设置进程的工作目录
            if (Directory.Exists("js") == false)
            {
                Directory.SetCurrentDirectory("../../");
            }
            Process.Start("http://localhost:82/index.html");
            Console.ReadLine();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.Title = typeof(Program).Namespace;

            // 用于提供静态html页面,也可以用IIS
            var httpServer = new HttpServer();
            httpServer.StartListen(82);
            Console.WriteLine("http服务启动成功 ..");

            // 当浏览器不支持websocket时,将由flash实现
            var flexPolicyServer = new FlexPolicyServer();
            flexPolicyServer.StartListen();
            Console.WriteLine("flex策略服务启动成功 ..");

            // websocket服务
            var webSocketServer = new ChatWebSocketServer();
            webSocketServer.StartListen(83);
            Console.WriteLine("WebSocket服务启动成功 ..");

            // 设置进程的工作目录
            if (Directory.Exists("js") == false)
            {
                Directory.SetCurrentDirectory("../../");
            }
            Process.Start("http://localhost:82/index.html");
            Console.ReadLine();
        }
 public void StartListenTest()
 {
     FlexPolicyServer target = new FlexPolicyServer(); // TODO: 初始化为适当的值
     target.StartListen();
     Assert.IsTrue(target.IsListening == true && target.Port == 843);
     target.Dispose();
 }
Exemplo n.º 4
0
        public void StartListenTest()
        {
            FlexPolicyServer target = new FlexPolicyServer(); // TODO: 初始化为适当的值

            target.StartListen();
            Assert.IsTrue(target.IsListening == true && target.Port == 843);
            target.Dispose();
        }
        public void PolicyTest()
        {
            FlexPolicyServer target = new FlexPolicyServer(); // TODO: 初始化为适当的值
            target.StartListen();

            var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            socket.Connect(new System.Net.IPEndPoint(IPAddress.Loopback, 843));
            socket.Send(new byte[] { 1, 2 });

            byte[] buffer = new byte[1024 * 8];
            var count = socket.Receive(buffer, SocketFlags.None);
            Assert.IsTrue(count > 0);
            var policy = Encoding.UTF8.GetString(buffer, 0, count);
            Assert.IsTrue(policy.StartsWith("<cross"));
        }
Exemplo n.º 6
0
        public void PolicyTest()
        {
            FlexPolicyServer target = new FlexPolicyServer(); // TODO: 初始化为适当的值

            target.StartListen();

            var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            socket.Connect(new System.Net.IPEndPoint(IPAddress.Loopback, 843));
            socket.Send(new byte[] { 1, 2 });

            byte[] buffer = new byte[1024 * 8];
            var    count  = socket.Receive(buffer, SocketFlags.None);

            Assert.IsTrue(count > 0);
            var policy = Encoding.UTF8.GetString(buffer, 0, count);

            Assert.IsTrue(policy.StartsWith("<cross"));
        }