protected Client(Socket s, Server server) { this.client = s; dataStream = new NetworkStream(s, true); IsUdp = server.IsUdp; IsTcp = server.IsTcp; }
public void TearDownEachTest() { singleClient.BeginDisconnect(); clients = null; server.StopListening(); server = null; }
public void SetupEachTest() { clients = new List<TestClient>(); server = new Server(); server.StartListening(LocalHost, TestPort); // Start listening on port. singleClient = new Client(); }
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; }