1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-15 22:56:30 +09:00

Tweaks + debug messages

This commit is contained in:
lidgren
2010-09-07 06:35:09 +00:00
parent 4c9e1df96b
commit fa3bd2646f
4 changed files with 13 additions and 3 deletions

View File

@@ -113,6 +113,9 @@ namespace Lidgren.Network
connectionReset = false;
try
{
if (target.Address == IPAddress.Broadcast)
m_socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);
int bytesSent = m_socket.SendTo(data, 0, numBytes, SocketFlags.None, target);
if (numBytes != bytesSent)
LogWarning("Failed to send the full " + numBytes + "; only " + bytesSent + " bytes sent in packet!");
@@ -131,6 +134,11 @@ namespace Lidgren.Network
{
LogError("Failed to send packet: " + ex);
}
finally
{
if (target.Address == IPAddress.Broadcast)
m_socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, false);
}
}
#else