1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-16 07:06:30 +09:00

- Patch from MonoGame; makes the BroadcastAddress configurable and changes text encoding from ASCII to UTF8, required for Android support

This commit is contained in:
lidgren
2012-06-08 07:35:02 +00:00
parent 1fdcb5f773
commit fbb6d9ed51
9 changed files with 119 additions and 8 deletions

View File

@@ -33,6 +33,7 @@ namespace Lidgren.Network
private readonly string m_appIdentifier;
private string m_networkThreadName;
private IPAddress m_localAddress;
private IPAddress m_broadcastAddress;
internal bool m_acceptIncomingConnections;
internal int m_maximumConnections;
internal int m_defaultOutgoingMessageCapacity;
@@ -76,6 +77,12 @@ namespace Lidgren.Network
m_disabledTypes = NetIncomingMessageType.ConnectionApproval | NetIncomingMessageType.UnconnectedData | NetIncomingMessageType.VerboseDebugMessage | NetIncomingMessageType.ConnectionLatencyUpdated;
m_networkThreadName = "Lidgren network thread";
m_localAddress = IPAddress.Any;
m_broadcastAddress = IPAddress.Broadcast;
var ip = NetUtility.GetBroadcastAddress();
if (ip != null)
{
m_broadcastAddress = ip;
}
m_port = 0;
m_receiveBufferSize = 131071;
m_sendBufferSize = 131071;
@@ -285,6 +292,17 @@ namespace Lidgren.Network
}
}
public IPAddress BroadcastAddress
{
get { return m_broadcastAddress; }
set
{
if (m_isLocked)
throw new NetException(c_isLockedMessage);
m_broadcastAddress = value;
}
}
/// <summary>
/// Gets or sets the local port to bind to. Defaults to 0. Cannot be changed once NetPeer is initialized.
/// </summary>