예제 #1
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;
        }
예제 #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;
        }
예제 #3
0
        internal NetsyChannel(AtomChannel atomChannel, IPackageSerializer packageSerializer, NetsyConnectionHelper.HandlerRegistry handlerRegistry)
        {
            Guard.NotNull(atomChannel, nameof(atomChannel));
            Guard.NotNull(packageSerializer, nameof(packageSerializer));
            Guard.NotNull(handlerRegistry, nameof(handlerRegistry));

            this._atomChannel = atomChannel;
            this._atomChannel.MessageReceived += this.AtomChannelOnMessageReceived;
            this._connectionHelper             = new NetsyConnectionHelper(packageSerializer, atomChannel.SendMessageAsync, handlerRegistry);

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