1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-17 07:36:32 +09:00

Suppressed Connection Reset messages. Fixed Chat server sample.

This commit is contained in:
lidgren
2011-11-06 09:24:08 +00:00
parent a64b5f2959
commit 95850b205a
2 changed files with 12 additions and 4 deletions

View File

@@ -106,6 +106,11 @@ namespace Lidgren.Network
m_socket.Blocking = false;
m_socket.Bind(ep);
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);
IPEndPoint boundEp = m_socket.LocalEndPoint as IPEndPoint;
LogDebug("Socket bound to " + boundEp + ": " + m_socket.IsBound);
m_listenPort = boundEp.Port;
@@ -349,6 +354,7 @@ namespace Lidgren.Network
// connection reset by peer, aka connection forcibly closed aka "ICMP port unreachable"
// we should shut down the connection; but m_senderRemote seemingly cannot be trusted, so which connection should we shut down?!
// So, what to do?
LogWarning("ConnectionReset");
return;
}