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); }
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); }
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); }
public void RemoveClient(ConectedClient client) { _conectedClients.Remove(client); }
public void AddClient(ConectedClient socket) { _conectedClients.Add(socket); }