AddServer() публичный Метод

public AddServer ( string name, IPEndPoint address ) : void
name string
address System.Net.IPEndPoint
Результат void
Пример #1
0
		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;
			}
		}
Пример #2
0
 public static void EventSink_ServerList( ServerListEventArgs e )
 {
     try
     {
         if (Core.Config.GameServers.Count == 0) {
             e.AddServer( ServerName, (IPEndPoint)e.State.Socket.LocalEndPoint );
         } else {
             foreach (Config.GameServer gs in Core.Config.GameServers)
                 e.AddServer(gs.Name, gs.Address);
         }
     }
     catch (Exception ex)
     {
         log.Fatal(ex);
         e.Rejected = true;
     }
 }
Пример #3
0
        public static void EventSink_ServerList(ServerListEventArgs e)
        {
            foreach (Config.GameServer gs in Core.Config.GameServers) {
                if (gs.Query && gs.Optional &&
                    ServerQueryTimer.GetStatus(gs) == null)
                    continue;

                e.AddServer(gs.Name, gs.Address);
            }
        }
Пример #4
0
        public static void EventSink_ServerList(ServerListEventArgs e)
        {
            GameServerListConfig gsl = Core.Config.GameServerListConfig;
            if (gsl == null) {
                e.Rejected = true;
                return;
            }

            foreach (GameServerConfig gs in gsl.GameServers)
                e.AddServer(gs.Name, gs.Address);
        }
Пример #5
0
        public static void EventSink_ServerList(ServerListEventArgs e)
        {
            foreach (Config.GameServer gs in Core.Config.GameServers)
            {
                if (gs.Query && gs.Optional &&
                    ServerQueryTimer.GetStatus(gs) == null)
                {
                    continue;
                }

                e.AddServer(gs.Name, gs.Address);
            }
        }
Пример #6
0
        public static void EventSink_ServerList(ServerListEventArgs e)
        {
            GameServerListConfig gsl = Core.Config.GameServerListConfig;

            if (gsl == null)
            {
                e.Rejected = true;
                return;
            }

            foreach (GameServerConfig gs in gsl.GameServers)
            {
                e.AddServer(gs.Name, gs.Address);
            }
        }
Пример #7
0
		public static void EventSink_ServerList( ServerListEventArgs e )
		{
			try
			{
				IPAddress ipAddr;

				if ( Resolve( Address != null && !IsLocalMachine( e.State ) ? Address : Dns.GetHostName(), out ipAddr ) )
					e.AddServer( ServerName, new IPEndPoint( ipAddr, Listener.Port ) );
				else
					e.Rejected = true;
			}
			catch
			{
				e.Rejected = true;
			}
		}
Пример #8
0
        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 ) );

                /*IPAddress testAddress;
                IPAddress.TryParse("127.0.0.1", out testAddress);
                e.AddServer("Test Center", new IPEndPoint(testAddress, 2594));*/
            }
            catch
            {
                e.Rejected = true;
            }
        }
Пример #9
0
        // ==================================================================================
        // The serverlist event
        // ==================================================================================
        public static void EventSink_ServerList( ServerListEventArgs e )
        {
            try
            {

                // ----------------------------------------------------
                // Lets find internet ip
                // ----------------------------------------------------
                DetectInternetIP();

                // ----------------------------------------------------
                // Find the server ip to use for this user
                // ----------------------------------------------------
                IPAddress ipAddr = FindMachineIP(e);

                // ----------------------------------------------------
                // Send serverlist
                // ----------------------------------------------------
                if (ipAddr != null)
                {
                    e.AddServer(ServerName, new IPEndPoint(ipAddr, 2593 ));//  Place the port that you are using here.
                } else {
                    e.Rejected = true;
                }
            }
            catch
            {
                e.Rejected = true;
            }
        }