Beispiel #1
0
 protected Client(Socket s, Server server)
 {
     this.client = s;
     dataStream = new NetworkStream(s, true);
     IsUdp = server.IsUdp;
     IsTcp = server.IsTcp;
 }
Beispiel #2
0
        public void TearDownEachTest()
        {
            singleClient.BeginDisconnect();

            clients = null;
            server.StopListening();
            server = null;
        }
Beispiel #3
0
        public void SetupEachTest()
        {
            clients = new List<TestClient>();

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

            singleClient = new Client();
        }
Beispiel #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;
        }