NAT Traversal for UNET
Provides NAT punch-through, automatic port forwarding, and other useful features on top of Unity's UNET HLAPI networking system.
NetworkConnectionExtension Class Reference

Static Public Member Functions

static void DisconnectConnection (this NetworkConnection conn)
 Use this to drop a client connection on the server instead of using conn.Disconnect(). More...
 

Member Function Documentation

◆ DisconnectConnection()

static void DisconnectConnection ( this NetworkConnection  conn)
static

Use this to drop a client connection on the server instead of using conn.Disconnect().

Punchthrough connections require some extra clean-up. Using this method in place of conn.Disconnect() will make sure the clean-up happens if the connection is a punchthrough connection. If for some reason you need to do this check manually it looks like:

if (conn.GetType() == typeof(ExternalNetworkConnection))
{
// This is a punchthrough connection
}
Parameters
conn