Esempio n. 1
0
        public static NetServer CreateServer(NetHost host = null)
        {
            NetServer instance = CreateInstance <NetServer>();

            if (host == null)
            {
                host = NetCore.Instance.AddHost(hostName: "NetServer Host");
            }

            instance.Initialize(host);
            return(instance);
        }
Esempio n. 2
0
        protected void Initialize(NetHost host)
        {
            if (status != Status.Uninitialized)
            {
                Log.WTF(this, $"Cannot initialize NetServer, because the status is {status.ToString()}", this);
                return;
            }

            netHost = host;

            // Bind events
            netHost.OnConnectEvent.RegisterListenerOnce(HandleClientConnected);
            netHost.OnDisconnectEvent.RegisterListener(HandleClientDisconnected);
            netHost.OnDataEvent.RegisterListener(HandleDataReceived);

            // Set status
            status = Status.InitializedNotRunning;
        }
Esempio n. 3
0
 public NetDataFilterHost(NetHost host)
 {
     this.host = host;
 }