//-----------------------------------------------------------------------------------------
        private void CreateNewTcpClient(string username)
        {
            Socket socket = _listener.GetSocket();

            TCPClient client = new TCPClient(socket, username);

            client.AddSerializer(_serializer);
            client.AddListener(_listener);
            client.Start();
            _clientList.Add(client);

            Console.WriteLine("Client Connected!!!");
        }
Ejemplo n.º 2
0
        public void ServerTcpClientStart()
        {
            //---------------------------------------------------------------------
            //Setup
            //---------------------------------------------------------------------
            server.Start();
            Thread thread = new Thread(AcceptSocket);

            thread.Start();

            TCP_Config config;

            config.address = "127.0.0.1";
            config.port    = 3520;

            IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 3520);
            TcpClient  tcpClient     = new TcpClient();

            tcpClient.Connect(localEndPoint);

            DotNetserialization serializer = new DotNetserialization();
            ServerListenerTCP   listener   = new ServerListenerTCP(config);

            Thread.Sleep(50);

            client.AddListener(listener);
            client.AddSerializer(serializer);

            //---------------------------------------------------------------------
            //Run Test
            //---------------------------------------------------------------------
            client.Start();

            //---------------------------------------------------------------------
            //Gather Output
            //---------------------------------------------------------------------

            //---------------------------------------------------------------------
            //Assert
            //---------------------------------------------------------------------
        }