当前位置: 首页>>代码示例>>C#>>正文


C# NetPeerConfiguration.IsMessageTypeEnabled方法代码示例

本文整理汇总了C#中Lidgren.Network.NetPeerConfiguration.IsMessageTypeEnabled方法的典型用法代码示例。如果您正苦于以下问题:C# NetPeerConfiguration.IsMessageTypeEnabled方法的具体用法?C# NetPeerConfiguration.IsMessageTypeEnabled怎么用?C# NetPeerConfiguration.IsMessageTypeEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lidgren.Network.NetPeerConfiguration的用法示例。


在下文中一共展示了NetPeerConfiguration.IsMessageTypeEnabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

        public static void Run(NetPeer peer)
        {
            NetPeerConfiguration config = new NetPeerConfiguration("Test");

            config.EnableMessageType(NetIncomingMessageType.UnconnectedData);
            if (config.IsMessageTypeEnabled(NetIncomingMessageType.UnconnectedData) == false)
                throw new NetException("setting enabled message types failed");

            config.SetMessageTypeEnabled(NetIncomingMessageType.UnconnectedData, false);
            if (config.IsMessageTypeEnabled(NetIncomingMessageType.UnconnectedData) == true)
                throw new NetException("setting enabled message types failed");

            Console.WriteLine("Misc tests OK");

            Console.WriteLine("Hex test: " + NetUtility.ToHexString(new byte[]{0xDE,0xAD,0xBE,0xEF}));
        }
开发者ID:JamieH,项目名称:lidgren-network-gen3,代码行数:16,代码来源:MiscTests.cs

示例2: Init

        internal void Init(int port)
        {
            InitMessageHandler();

              int receiveBufferSize = 64;
              int sendBufferSize = 64;
              StringBuilder sb = new StringBuilder(256);
              if (CenterClientApi.GetConfig("ReceiveBufferSize", sb, 256)) {
            receiveBufferSize = int.Parse(sb.ToString());
              }
              if (CenterClientApi.GetConfig("SendBufferSize", sb, 256)) {
            sendBufferSize = int.Parse(sb.ToString());
              }

              m_Config = new NetPeerConfiguration("RoomServer");
              m_Config.MaximumConnections = 1024;
              m_Config.SocketReceiveBufferSize = receiveBufferSize * 1024 * 1024;
              m_Config.SocketSendBufferSize = sendBufferSize * 1024 * 1024;
              m_Config.Port = port;
              m_Config.DisableMessageType(NetIncomingMessageType.DebugMessage);
              m_Config.DisableMessageType(NetIncomingMessageType.VerboseDebugMessage);
              //m_Config.EnableMessageType(NetIncomingMessageType.DebugMessage);
              //m_Config.EnableMessageType(NetIncomingMessageType.VerboseDebugMessage);
              m_Config.EnableMessageType(NetIncomingMessageType.ErrorMessage);
              m_Config.EnableMessageType(NetIncomingMessageType.WarningMessage);

              if (m_Config.IsMessageTypeEnabled(NetIncomingMessageType.DebugMessage))
            LogSys.Log(LOG_TYPE.DEBUG, "Enable NetIncomingMessageType.DebugMessage");
              if (m_Config.IsMessageTypeEnabled(NetIncomingMessageType.VerboseDebugMessage))
            LogSys.Log(LOG_TYPE.DEBUG, "Enable NetIncomingMessageType.VerboseDebugMessage");
              if (m_Config.IsMessageTypeEnabled(NetIncomingMessageType.ErrorMessage))
            LogSys.Log(LOG_TYPE.DEBUG, "Enable NetIncomingMessageType.ErrorMessage");
              if (m_Config.IsMessageTypeEnabled(NetIncomingMessageType.WarningMessage))
            LogSys.Log(LOG_TYPE.DEBUG, "Enable NetIncomingMessageType.WarningMessage");

              m_NetServer = new NetServer(m_Config);
              m_NetServer.Start();
              m_IOThread = new Thread(new ThreadStart(IOHandler));
              m_IOThread.Name = "IOHandler";
              m_IOThread.IsBackground = true;
              m_Status = RoomSrvStatus.STATUS_RUNNING;
              m_IOThread.Start();
              RoomPeerMgr.Instance.Init();
              Console.WriteLine("Init IOManager OK!");
        }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:45,代码来源:IoManager.cs


注:本文中的Lidgren.Network.NetPeerConfiguration.IsMessageTypeEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。