示例#1
0
 protected Client(Socket s, Server server)
 {
     this.client = s;
     dataStream = new NetworkStream(s, true);
     IsUdp = server.IsUdp;
     IsTcp = server.IsTcp;
 }
示例#2
0
文件: BasicTests.cs 项目: gitsly/game
        public void TearDownEachTest()
        {
            singleClient.BeginDisconnect();

            clients = null;
            server.StopListening();
            server = null;
        }
示例#3
0
文件: BasicTests.cs 项目: gitsly/game
        public void SetupEachTest()
        {
            clients = new List<TestClient>();

            server = new Server();
            server.StartListening(LocalHost, TestPort); // Start listening on port.

            singleClient = new Client();
        }
示例#4
0
        static void InitServer(EventManager ev, ushort port)
        {
            var p = new Parser();
            p.PacketNotFound += (pck) => Console.WriteLine("Packet inconnu [ID={0}]", pck.Header.ID);
            _s = new Server(ev, p.Parse);
            _s.ClientConnected += (c) => Console.WriteLine("Client connected [{0}]", c.ToString());
            _s.ClientDisconnected += (c) => Console.WriteLine("Client disconnected [{0}]", c.ToString());
            _s.Start(port);

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Server UP !");
            Console.ForegroundColor = ConsoleColor.Gray;
        }