diff --git a/Lidgren.Network/NetOutgoingMessage.Write.cs b/Lidgren.Network/NetOutgoingMessage.Write.cs
index af3d201..2f66f4a 100644
--- a/Lidgren.Network/NetOutgoingMessage.Write.cs
+++ b/Lidgren.Network/NetOutgoingMessage.Write.cs
@@ -518,7 +518,7 @@ namespace Lidgren.Network
}
byte[] bytes = Encoding.UTF8.GetBytes(source);
- EnsureBufferSize(m_bitLength + 1 + bytes.Length);
+ EnsureBufferSize(m_bitLength + 1 + (bytes.Length * 8));
WriteVariableUInt32((uint)bytes.Length);
Write(bytes);
}
diff --git a/Lidgren.Network/NetPeer.cs b/Lidgren.Network/NetPeer.cs
index 1ce1709..76493be 100644
--- a/Lidgren.Network/NetPeer.cs
+++ b/Lidgren.Network/NetPeer.cs
@@ -150,6 +150,19 @@ namespace Lidgren.Network
Thread.Sleep(3);
}
+ ///
+ /// Returns true if there is a queued message available to read using ReadMessage()
+ ///
+ public bool MessageAvailable
+ {
+ get
+ {
+ if (m_status == NetPeerStatus.NotRunning)
+ return false;
+ return (m_releasedIncomingMessages.Count > 0);
+ }
+ }
+
///
/// Read a pending message from any connection, if any
///
diff --git a/Lidgren.Network/NetPeerConfiguration.cs b/Lidgren.Network/NetPeerConfiguration.cs
index b4792da..1086663 100644
--- a/Lidgren.Network/NetPeerConfiguration.cs
+++ b/Lidgren.Network/NetPeerConfiguration.cs
@@ -93,9 +93,10 @@ namespace Lidgren.Network
m_disabledTypes = NetIncomingMessageType.ConnectionApproval | NetIncomingMessageType.UnconnectedData | NetIncomingMessageType.VerboseDebugMessage;
// Maximum transmission unit
+ // Ethernet can take 1500 bytes of payload, so lets stay below that.
// The aim is for a max full packet to be 1440 bytes (30 x 48 bytes, lower than 1468)
- // 20 bytes ip header
- // 8 bytes udp header
+ // 20 bytes IP header
+ // 8 bytes UDP header
// 5 bytes lidgren header for one message
// 1 byte just to be on the safe side
// Totals 1440 minus 34 = 1406 bytes free for payload