Exemple #1
0
        private void Receive()
        {
            string message = "";

            while (!message.Contains(endMessage))
            {
                int length = Clientsocket.Receive(buffer);
                message = Encoding.UTF8.GetString(buffer, 0, length);
                if (Name == null && message.Contains(":"))
                {
                    Name = message.Split(':')[0];
                }

                action(message, Clientsocket);
            }
            Close();
        }
Exemple #2
0
        private void Receive()
        {
            string message = "";

            while (!message.Equals(endMessage))
            {
                int length = Clientsocket.Receive(buffer);
                message = Encoding.UTF8.GetString(buffer, 0, length);
                //set name prop if not already done
                if (Name == null && message.Contains(":"))
                {
                    Name = message.Split(':')[0];
                }
                //inform GUI via delegate
                action(message, Clientsocket);
            }
            Close();
        }