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); }
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; }