private static void EventSink_ServerList( ServerListEventArgs e )
{
try
{
NetState ns = e.State;
Socket s = ns.Socket;
IPEndPoint ipep = (IPEndPoint)s.LocalEndPoint;
IPAddress localAddress = ipep.Address;
int localPort = ipep.Port;
if ( IsPrivateNetwork( localAddress ) ) {
ipep = (IPEndPoint)s.RemoteEndPoint;
if ( !IsPrivateNetwork( ipep.Address ) && m_PublicAddress != null )
localAddress = m_PublicAddress;
}
e.AddServer( ServerName, new IPEndPoint( localAddress, localPort ) );
}
catch
{
e.Rejected = true;
}
}