本文整理汇总了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}));
}
示例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!");
}