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(); }
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(); }