Example #1
0
        private void RecivePacket(object peer)
        {
            NetIncomingMessage msg;

            while ((msg = InnerClient.ReadMessage()) != null)
            {
                switch (msg.MessageType)
                {
                case NetIncomingMessageType.DebugMessage:
                case NetIncomingMessageType.ErrorMessage:
                case NetIncomingMessageType.WarningMessage:
                case NetIncomingMessageType.VerboseDebugMessage:
                    break;

                case NetIncomingMessageType.DiscoveryResponse:
                    InnerClient.Connect(msg.SenderEndPoint);
                    break;

                case NetIncomingMessageType.StatusChanged:
                    OnStatusMessage(this, msg);
                    break;

                case NetIncomingMessageType.Data:
                    OnDataMessage(this, msg);
                    break;
                }
            }
        }