Exemplo n.º 1
0
        internal void updateClient(ConectedClient client)
        {
            var oldClient = _conectedClients.First(c => c.clientGuid == client.clientGuid);
            var newClient = new ConectedClient().CopyClient(oldClient);

            _conectedClients.Remove(oldClient);
            _conectedClients.Add(newClient);
        }
Exemplo n.º 2
0
        public ConectedClient CopyClient(ConectedClient oldCLient)
        {
            var newClient = new ConectedClient()
            {
                clientsocet         = oldCLient.clientsocet,
                clientGuid          = oldCLient.clientGuid,
                isValidated         = oldCLient.isValidated,
                brodcastNextMessage = oldCLient.brodcastNextMessage,
                LoginAtempt         = oldCLient.LoginAtempt
            };

            return(newClient);
        }
Exemplo n.º 3
0
        private void AcceptCallback(IAsyncResult ar)
        {
            if (serverSettings.closing)
            {
                return;
            }
            var socket = _socket.EndAccept(ar);
            var client = new ConectedClient(socket);

            serverSettings.AddClient(client);
            //string welcome = string.Format("Welcome to server you are user {0}", client.clientGuid);
            OnClientConnect(new NewClientConnectedEventArgs(client.clientGuid));
            //SendData(socket, Encoding.UTF8.GetBytes(welcome));
            BeginRecive(socket);
            Console.WriteLine("Client connected, waiting for request...");
            _socket.BeginAccept(AcceptCallback, null);
        }
Exemplo n.º 4
0
 public void RemoveClient(ConectedClient client)
 {
     _conectedClients.Remove(client);
 }
Exemplo n.º 5
0
 public void AddClient(ConectedClient socket)
 {
     _conectedClients.Add(socket);
 }