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

            this.Address = address;
            this.State   = AtomClientState.Disconnected;
            this.Data    = new Dictionary <string, object>();
            this._plugin = plugin ?? new NullAtomClientPlugin();
            this._lock   = new SemaphoreSlim(1, 1);

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

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

            this._atomClient        = new AtomClient(address, plugin);
            this._packageSerializer = packageSerializer;

            this._handlerRegistry  = new NetsyConnectionHelper.HandlerRegistry();
            this._connectionHelper = new NetsyConnectionHelper(packageSerializer, f => this._atomClient.SendMessageAsync(f), this._handlerRegistry);

            this._atomClient.MessageReceived += this.AtomClientOnMessageReceived;
        }