Example #1
0
        public override bool Open(NetworkServerConfig config)
        {
            if (!NetworkCore.CreateUdpClient(config.LocalEndPoint, out var socket))
            {
                return(false);
            }

            ServerConfig = CheckConfig(config);
            UdpClient    = socket;
            Connections  = new BaseNetworkConnection[ServerConfig.MaxClients];

            for (var i = 0; i < Salts.Length; i++)
            {
                Secure.RandomFill(Salts[i]);
            }

            LastSaltUpdate       = Time.Get();
            LegacyRateLimitStart = -1;
            LegacyRateLimitNum   = 0;

            for (var i = 0; i < Connections.Length; i++)
            {
                Connections[i] = Kernel.Get <BaseNetworkConnection>();
                Connections[i].Init(UdpClient);
            }

            return(true);
        }
Example #2
0
 public override void Start(IPEndPoint remote,
                            BaseNetworkConnection connection, int clientId)
 {
     EndPoint     = remote;
     Connection   = connection;
     ClientId     = clientId;
     CurrentChunk = 0;
     Valid        = true;
 }
Example #3
0
        public override bool Open(NetworkServerConfig config)
        {
            if (!NetworkHelper.UdpClient(config.BindEndPoint, out var socket))
            {
                return(false);
            }

            UdpClient = socket;
            TokenManager.Init(UdpClient);
            TokenCache.Init(UdpClient, TokenManager);

            Config      = CheckConfig(config);
            Connections = new BaseNetworkConnection[Config.MaxClients];

            for (var i = 0; i < Connections.Count; i++)
            {
                Connections[i] = Kernel.Get <BaseNetworkConnection>();
                Connections[i].Init(UdpClient, Config.ConnectionConfig);
            }

            return(true);
        }
Example #4
0
 public abstract void Start(IPEndPoint remote, BaseNetworkConnection connection,
                            int clientId);