diff --git a/Lidgren.Network.userprefs b/Lidgren.Network.userprefs
index e3e12df..7032d3b 100644
--- a/Lidgren.Network.userprefs
+++ b/Lidgren.Network.userprefs
@@ -1,24 +1,22 @@
-
+
-
+
-
-
+
-
+
-
-
-
-
+
-
+
+
+
\ No newline at end of file
diff --git a/Lidgren.Network/Lidgren.Network.csproj b/Lidgren.Network/Lidgren.Network.csproj
index 07b440b..9adc7c1 100644
--- a/Lidgren.Network/Lidgren.Network.csproj
+++ b/Lidgren.Network/Lidgren.Network.csproj
@@ -34,7 +34,7 @@
full
false
bin\Debug\
- DEBUG;TRACE;__CONSTRAINED__
+ DEBUG;TRACE
prompt
4
AllRules.ruleset
diff --git a/Lidgren.Network/NetPeer.Internal.cs b/Lidgren.Network/NetPeer.Internal.cs
index 1718e3c..84a0632 100644
--- a/Lidgren.Network/NetPeer.Internal.cs
+++ b/Lidgren.Network/NetPeer.Internal.cs
@@ -4,12 +4,12 @@ using System.Threading;
using System.Diagnostics;
using System.Security.Cryptography;
using System.Net.Sockets;
-using System.Collections.Generic;
-
+using System.Collections.Generic;
+
#if !__NOIPENDPOINT__
-using NetEndPoint = System.Net.IPEndPoint;
+using NetEndPoint = System.Net.IPEndPoint;
#endif
-
+
namespace Lidgren.Network
{
public partial class NetPeer
@@ -39,13 +39,13 @@ namespace Lidgren.Network
internal bool m_executeFlushSendQueue;
private AutoResetEvent m_messageReceivedEvent;
- private List> m_receiveCallbacks;
-
+ private List> m_receiveCallbacks;
+
///
/// Gets the socket, if Start() has been called
///
- public Socket Socket { get { return m_socket; } }
-
+ public Socket Socket { get { return m_socket; } }
+
///
/// Call this to register a callback for when a new message arrives
///
@@ -58,18 +58,18 @@ namespace Lidgren.Network
if (m_receiveCallbacks == null)
m_receiveCallbacks = new List>();
m_receiveCallbacks.Add(new NetTuple(syncContext, callback));
- }
-
+ }
+
///
/// Call this to unregister a callback, but remember to do it in the same synchronization context!
///
public void UnregisterReceivedCallback(SendOrPostCallback callback)
{
if (m_receiveCallbacks == null)
- return;
-
- // remove all callbacks regardless of sync context
- m_receiveCallbacks.RemoveAll(tuple => tuple.Item2.Equals(callback));
+ return;
+
+ // remove all callbacks regardless of sync context
+ m_receiveCallbacks.RemoveAll(tuple => tuple.Item2.Equals(callback));
if (m_receiveCallbacks.Count < 1)
m_receiveCallbacks = null;
@@ -112,7 +112,7 @@ namespace Lidgren.Network
if (now - m_lastSocketBind < 1.0)
{
LogDebug("Suppressed socket rebind; last bound " + (now - m_lastSocketBind) + " seconds ago");
- return; // only allow rebind once every second
+ return; // only allow rebind once every second
}
m_lastSocketBind = now;
@@ -127,17 +127,23 @@ namespace Lidgren.Network
m_socket.Blocking = false;
var ep = (EndPoint)new NetEndPoint(m_configuration.LocalAddress, reBind ? m_listenPort : m_configuration.Port);
- m_socket.Bind(ep);
-
+ m_socket.Bind(ep);
+
+ // try catch only works on linux not osx
try
- {
- //const uint IOC_IN = 0x80000000;
- //const uint IOC_VENDOR = 0x18000000;
- //uint SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12;
- //m_socket.IOControl((int)SIO_UDP_CONNRESET, new byte[] { Convert.ToByte(false) }, null);
+ {
+ // this is not supported in mono / mac or linux yet.
+ if(Environment.OSVersion.Platform != PlatformID.Unix)
+ {
+ const uint IOC_IN = 0x80000000;
+ const uint IOC_VENDOR = 0x18000000;
+ uint SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12;
+ m_socket.IOControl((int)SIO_UDP_CONNRESET, new byte[] { Convert.ToByte(false) }, null);
+ }
}
- catch
+ catch (System.Exception e)
{
+ // this will be thrown on linux but not mac if it doesn't exist.
// ignore; SIO_UDP_CONNRESET not supported on this platform
}
diff --git a/UnitTests/UnitTests.csproj b/UnitTests/UnitTests.csproj
index b1ed00e..0b024cf 100644
--- a/UnitTests/UnitTests.csproj
+++ b/UnitTests/UnitTests.csproj
@@ -1,5 +1,5 @@
-
+
Debug
x86