// Receive data from the network NetIncomingMessage message; while ((message = netClient.ReadMessage()) != null) { switch (message.MessageType) { case NetIncomingMessageType.Data: // Handle data message byte[] data = message.ReadBytes(message.LengthBytes); Console.WriteLine("Received data: " + Encoding.UTF8.GetString(data)); break; case NetIncomingMessageType.StatusChanged: // Handle status changed message NetConnectionStatus status = (NetConnectionStatus)message.ReadByte(); Console.WriteLine("Status changed: " + status.ToString()); break; case NetIncomingMessageType.DebugMessage: // Handle debug message Console.WriteLine("Debug message: " + message.ReadString()); break; // Handle other message types } }In this example, the code reads incoming messages from a network client and handles them based on their message type. If the message type is Data, the code gets the bytes of the message data and displays them as a string. If the message type is StatusChanged, the code gets the new status of the network connection and displays it as a string. If the message type is DebugMessage, the code displays the message as a string. Package library: Lidgren.Network