public static IPEndPoint GetClientEndpoint(this ClientConnection me) { LidgrenDuplexChannel channel = (LidgrenDuplexChannel) me.GetType().GetField("Channel", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(me); return(new IPEndPoint(IPAddress.Loopback, channel.Connection.Peer.Port)); }
private void HandleNewConnection(NetConnection netConnection) { lock (netConnection) { var channel = new LidgrenDuplexChannel(_serializer, _cryptoProviderResolver) { Connection = netConnection }; if (OnChannelOpen != null) { OnChannelOpen(channel); } netConnection.Tag = channel; } }