private void Recieve(IAsyncResult result) { Socket client = result.AsyncState as Socket; if (TcpService.clientPool.Count != 0) { ClientInfo CI = (from t in TcpService.clientPool where t.socket == client select t).FirstOrDefault <ClientInfo>(); if (CI != null) { try { client.EndReceive(result); byte[] buffer = CI.buffer; client.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, new AsyncCallback(this.Recieve), client); object obj = Serialize.ByteToObject(buffer); if (obj != null) { SocketInfo socketMsg = (SocketInfo)obj; if (CI.UserName == null) { lock (TcpService.clientPool) { (from t in TcpService.clientPool where t.socket == client select t).FirstOrDefault <ClientInfo>().UserName = socketMsg.Name; } } this.Listen.ReciveSocket(CI, socketMsg); } } catch { } } } }