Exemplo n.º 1
0
        public override void Execute()
        {
            var info = new StartServerInfo()
            {
                Port           = Constants.ServerPort,
                MaxConnections = Constants.MultiplayerMaxConnections,
                Config         = new ConnectionConfig()
            };

            Server.Start(info);
        }
Exemplo n.º 2
0
        public void Start(StartServerInfo info)
        {
            var config         = info.Config;
            var port           = info.Port;
            var maxConnections = info.MaxConnections;

            config.AddChannel(QosType.ReliableSequenced);
            config.AddChannel(QosType.UnreliableSequenced);
            config.PacketSize = 1470;
            NetworkServer.Configure(config, maxConnections);
            NetworkServer.Listen(port);

            if (NetworkServer.active)
            {
                Port = port;
                Debug.Log("Server started on port: " + port);
            }
            else
            {
                Debug.Log("Couldn't start server on port: " + port);
            }
        }