本文整理汇总了C#中Lidgren.Network.NetPeerConfiguration.set_BroadcastAddress方法的典型用法代码示例。如果您正苦于以下问题:C# NetPeerConfiguration.set_BroadcastAddress方法的具体用法?C# NetPeerConfiguration.set_BroadcastAddress怎么用?C# NetPeerConfiguration.set_BroadcastAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lidgren.Network.NetPeerConfiguration
的用法示例。
在下文中一共展示了NetPeerConfiguration.set_BroadcastAddress方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Find
internal static void Find(NetworkSessionType sessionType)
{
NetPeerConfiguration peerConfiguration = new NetPeerConfiguration(MonoGamerPeer.applicationIdentifier);
if (sessionType == NetworkSessionType.PlayerMatch)
{
peerConfiguration.EnableMessageType((NetIncomingMessageType) 2);
peerConfiguration.EnableMessageType((NetIncomingMessageType) 2048);
}
else
peerConfiguration.EnableMessageType((NetIncomingMessageType) 32);
if (MonoGameNetworkConfiguration.Broadcast != IPAddress.None)
peerConfiguration.set_BroadcastAddress(MonoGameNetworkConfiguration.Broadcast);
MonoGamerPeer.netPeer = new NetPeer(peerConfiguration);
MonoGamerPeer.netPeer.Start();
if (sessionType == NetworkSessionType.PlayerMatch)
MonoGamerPeer.GetServerList(MonoGamerPeer.netPeer);
else
MonoGamerPeer.netPeer.DiscoverLocalPeers(MonoGamerPeer.port);
DateTime now = DateTime.Now;
MonoGamerPeer.discoveryMsgs = new List<NetIncomingMessage>();
do
{
NetIncomingMessage netIncomingMessage;
while ((netIncomingMessage = MonoGamerPeer.netPeer.ReadMessage()) != null)
{
NetIncomingMessageType messageType = netIncomingMessage.get_MessageType();
if (messageType <= 128)
{
if (messageType != 2)
{
if (messageType != 64)
{
if (messageType == 128)
;
}
else
MonoGamerPeer.discoveryMsgs.Add(netIncomingMessage);
}
else if (netIncomingMessage.get_SenderEndpoint().Equals((object) MonoGamerPeer.m_masterServer))
MonoGamerPeer.discoveryMsgs.Add(netIncomingMessage);
}
else if (messageType == 256 || messageType == 512 || messageType == 1024)
;
}
}
while ((DateTime.Now - now).Seconds <= 2);
MonoGamerPeer.netPeer.Shutdown("Find shutting down");
}