Beispiel #1
0
        public void Shutdown()
        {
            Log.Information("Server socket closing...");
            NetworkSocket?.Shutdown("Server going down for quit");

            NetworkSocket    = null;
            NetworkPipe      = null;
            NetConfiguration = null;
        }
Beispiel #2
0
        public override void Start()
        {
            Log.Information("Started logging NetworkServer.");

            NetConfiguration = new NetPeerConfiguration("unity")
            {
                MaximumConnections = MaxPlayers,
                Port = 27015
            };

            NetConfiguration.EnableMessageType(NetIncomingMessageType.NatIntroductionSuccess);

            if (NetworkDiscovery)
            {
                NetConfiguration.EnableUPnP = true;
            }

            NetworkSocket = new NetServer(this.NetConfiguration);
            NetworkPipe   = new ServerMessagePipe(this.NetworkSocket);
            NetworkSocket.Start();
        }