Esempio n. 1
0
        public AtomServer(IPEndPoint address, IAtomServerPlugin plugin = null)
        {
            Guard.NotNull(address, nameof(address));

            this.Address   = address;
            this.State     = AtomServerState.Stopped;
            this._channels = new ConcurrentDictionary <Guid, AtomChannel>();
            this._lock     = new SemaphoreSlim(1, 1);
            this._plugin   = plugin ?? new NullAtomServerPlugin();
            this.Data      = new Dictionary <string, object>();

            this._plugin.OnAppliedToServer(this);
        }
Esempio n. 2
0
        public NetsyServer(IPEndPoint address, IPackageSerializer packageSerializer, IAtomServerPlugin plugin = null)
        {
            Guard.NotNull(address, nameof(address));
            Guard.NotNull(packageSerializer, nameof(packageSerializer));

            this.Data = new Dictionary <string, object>();

            this._channels        = new ConcurrentDictionary <Guid, NetsyChannel>();
            this._handlerRegistry = new NetsyConnectionHelper.HandlerRegistry();

            this._atomServer        = new AtomServer(address, plugin);
            this._packageSerializer = packageSerializer;

            this._atomServer.ChannelConnected    += this.AtomServerOnChannelConnected;
            this._atomServer.ChannelDisconnected += this.AtomServerOnChannelDisconnected;
        }