protected override void DoSetAll(IoSessionConfig config)
        {
            IDatagramSessionConfig cfg = config as IDatagramSessionConfig;

            if (cfg == null)
            {
                return;
            }

            if (cfg.EnableBroadcast.HasValue)
            {
                EnableBroadcast = cfg.EnableBroadcast;
            }
            if (cfg.ReceiveBufferSize.HasValue)
            {
                ReceiveBufferSize = cfg.ReceiveBufferSize;
            }
            if (cfg.SendBufferSize.HasValue)
            {
                SendBufferSize = cfg.SendBufferSize;
            }
            if (cfg.ReuseAddress.HasValue)
            {
                ReuseAddress = cfg.ReuseAddress;
            }
            if (cfg.TrafficClass.HasValue)
            {
                TrafficClass = cfg.TrafficClass;
            }
            if (cfg.ExclusiveAddressUse.HasValue)
            {
                ExclusiveAddressUse = cfg.ExclusiveAddressUse;
            }
            MulticastOption = cfg.MulticastOption;
        }
        protected override void DoSetAll(IoSessionConfig config)
        {
            ISocketSessionConfig cfg = config as ISocketSessionConfig;
            if (cfg == null)
                return;

            if (cfg.ReceiveBufferSize.HasValue)
                ReceiveBufferSize = cfg.ReceiveBufferSize;
            if (cfg.SendBufferSize.HasValue)
                SendBufferSize = cfg.SendBufferSize;
            if (cfg.ReuseAddress.HasValue)
                ReuseAddress = cfg.ReuseAddress;
            if (cfg.TrafficClass.HasValue)
                TrafficClass = cfg.TrafficClass;
            if (cfg.ExclusiveAddressUse.HasValue)
                ExclusiveAddressUse = cfg.ExclusiveAddressUse;
            if (cfg.KeepAlive.HasValue)
                KeepAlive = cfg.KeepAlive;
            if (cfg.OobInline.HasValue)
                OobInline = cfg.OobInline;
            if (cfg.NoDelay.HasValue)
                NoDelay = cfg.NoDelay;
            if (cfg.SoLinger.HasValue)
                SoLinger = cfg.SoLinger;
        }
 protected override void DoSetAll(IoSessionConfig config)
 {
     ISerialSessionConfig cfg = config as ISerialSessionConfig;
     if (cfg != null)
     {
         ReadTimeout = cfg.ReadTimeout;
         WriteBufferSize = cfg.WriteBufferSize;
         ReceivedBytesThreshold = cfg.ReceivedBytesThreshold;
     }
 }
            public SocketContext(System.Net.Sockets.Socket socket, IoSessionConfig config)
            {
                _socket = socket;

                _completeHandler = OnCompleted;

                Byte[] writeBuffer = new Byte[config.ReadBufferSize];
                _writeBuffer = SocketAsyncEventArgsBufferAllocator.Instance.Wrap(writeBuffer);
                _writeBuffer.SocketAsyncEventArgs.Completed += new EventHandler<SocketAsyncEventArgs>(OnCompleted);
                _writeBuffer.SocketAsyncEventArgs.UserToken = this;
            }
Example #5
0
 public void SetAll(IoSessionConfig config)
 {
     if (config == null)
         throw new ArgumentNullException(nameof(config));
     ReadBufferSize = config.ReadBufferSize;
     ThroughputCalculationInterval = config.ThroughputCalculationInterval;
     ReaderIdleTime = config.ReaderIdleTime;
     WriterIdleTime = config.WriterIdleTime;
     BothIdleTime = config.BothIdleTime;
     WriteTimeout = config.WriteTimeout;
 }
Example #6
0
            public SocketContext(System.Net.Sockets.Socket socket, IoSessionConfig config)
            {
                _socket = socket;

                _completeHandler = OnCompleted;

                Byte[] writeBuffer = new Byte[config.ReadBufferSize];
                _writeBuffer = SocketAsyncEventArgsBufferAllocator.Instance.Wrap(writeBuffer);
                _writeBuffer.SocketAsyncEventArgs.Completed += new EventHandler <SocketAsyncEventArgs>(OnCompleted);
                _writeBuffer.SocketAsyncEventArgs.UserToken  = this;
            }
Example #7
0
        protected override void DoSetAll(IoSessionConfig config)
        {
            ISerialSessionConfig cfg = config as ISerialSessionConfig;

            if (cfg != null)
            {
                ReadTimeout            = cfg.ReadTimeout;
                WriteBufferSize        = cfg.WriteBufferSize;
                ReceivedBytesThreshold = cfg.ReceivedBytesThreshold;
            }
        }
Example #8
0
 public void SetAll(IoSessionConfig config)
 {
     if (config == null)
     {
         throw new ArgumentNullException(nameof(config));
     }
     ReadBufferSize = config.ReadBufferSize;
     ThroughputCalculationInterval = config.ThroughputCalculationInterval;
     ReaderIdleTime = config.ReaderIdleTime;
     WriterIdleTime = config.WriterIdleTime;
     BothIdleTime   = config.BothIdleTime;
     WriteTimeout   = config.WriteTimeout;
 }
 /// <inheritdoc/>
 public void SetAll(IoSessionConfig config)
 {
     if (config == null)
     {
         throw new ArgumentNullException("config");
     }
     ReadBufferSize = config.ReadBufferSize;
     SetIdleTime(IdleStatus.BothIdle, config.GetIdleTime(IdleStatus.BothIdle));
     SetIdleTime(IdleStatus.ReaderIdle, config.GetIdleTime(IdleStatus.ReaderIdle));
     SetIdleTime(IdleStatus.WriterIdle, config.GetIdleTime(IdleStatus.WriterIdle));
     ThroughputCalculationInterval = config.ThroughputCalculationInterval;
     DoSetAll(config);
 }
Example #10
0
            public void SetAll(IoSessionConfig config)
            {
                if (config == null)
                {
                    throw new ArgumentNullException("config");
                }
                SetIdleTime(IdleStatus.BothIdle, config.GetIdleTime(IdleStatus.BothIdle));
                SetIdleTime(IdleStatus.ReaderIdle, config.GetIdleTime(IdleStatus.ReaderIdle));
                SetIdleTime(IdleStatus.WriterIdle, config.GetIdleTime(IdleStatus.WriterIdle));
                ThroughputCalculationInterval = config.ThroughputCalculationInterval;

                // other properties will be set in SerialConnector.Connect()
            }
Example #11
0
 protected SocketSession(IoService service, IoProcessor processor, IoSessionConfig config,
     System.Net.Sockets.Socket socket, EndPoint localEP, EndPoint remoteEP, Boolean reuseBuffer)
     : base(service)
 {
     _socket = socket;
     _localEP = localEP;
     _remoteEP = remoteEP;
     Config = config;
     if (service.SessionConfig != null)
         Config.SetAll(service.SessionConfig);
     _processor = processor;
     _filterChain = new DefaultIoFilterChain(this);
 }
Example #12
0
 /// <summary>
 /// </summary>
 protected SocketSession(IoService service, IoProcessor processor, IoSessionConfig config,
                         System.Net.Sockets.Socket socket, EndPoint localEP, EndPoint remoteEP, Boolean reuseBuffer)
     : base(service)
 {
     _socket   = socket;
     _localEP  = localEP;
     _remoteEP = remoteEP;
     Config    = config;
     if (service.SessionConfig != null)
     {
         Config.SetAll(service.SessionConfig);
     }
     _processor   = processor;
     _filterChain = new DefaultIoFilterChain(this);
 }
        protected override void DoSetAll(IoSessionConfig config)
        {
            ISocketSessionConfig cfg = config as ISocketSessionConfig;

            if (cfg == null)
            {
                return;
            }

            if (cfg.ReceiveBufferSize.HasValue)
            {
                ReceiveBufferSize = cfg.ReceiveBufferSize;
            }
            if (cfg.SendBufferSize.HasValue)
            {
                SendBufferSize = cfg.SendBufferSize;
            }
            if (cfg.ReuseAddress.HasValue)
            {
                ReuseAddress = cfg.ReuseAddress;
            }
            if (cfg.TrafficClass.HasValue)
            {
                TrafficClass = cfg.TrafficClass;
            }
            if (cfg.ExclusiveAddressUse.HasValue)
            {
                ExclusiveAddressUse = cfg.ExclusiveAddressUse;
            }
            if (cfg.KeepAlive.HasValue)
            {
                KeepAlive = cfg.KeepAlive;
            }
            if (cfg.OobInline.HasValue)
            {
                OobInline = cfg.OobInline;
            }
            if (cfg.NoDelay.HasValue)
            {
                NoDelay = cfg.NoDelay;
            }
            if (cfg.SoLinger.HasValue)
            {
                SoLinger = cfg.SoLinger;
            }
        }
        protected override void DoSetAll(IoSessionConfig config)
        {
            IDatagramSessionConfig cfg = config as IDatagramSessionConfig;
            if (cfg == null)
                return;

            if (cfg.EnableBroadcast.HasValue)
                EnableBroadcast = cfg.EnableBroadcast;
            if (cfg.ReceiveBufferSize.HasValue)
                ReceiveBufferSize = cfg.ReceiveBufferSize;
            if (cfg.SendBufferSize.HasValue)
                SendBufferSize = cfg.SendBufferSize;
            if (cfg.ReuseAddress.HasValue)
                ReuseAddress = cfg.ReuseAddress;
            if (cfg.TrafficClass.HasValue)
                TrafficClass = cfg.TrafficClass;
            if (cfg.ExclusiveAddressUse.HasValue)
                ExclusiveAddressUse = cfg.ExclusiveAddressUse;
            MulticastOption = cfg.MulticastOption;
        }
Example #15
0
 /// <summary>
 /// </summary>
 protected AbstractIoService(IoSessionConfig sessionConfig)
 {
     _sessionConfig = sessionConfig;
     _handler       = new InnerHandler(this);
     _stats         = new IoServiceStatistics(this);
 }
Example #16
0
 /// <summary>
 /// </summary>
 protected AbstractIoConnector(IoSessionConfig sessionConfig)
     : base(sessionConfig)
 {
 }
 protected AbstractIoAcceptor(IoSessionConfig sessionConfig)
     : base(sessionConfig)
 { 
     _bindLock = ((ICollection)_boundEndPoints).SyncRoot;
 }
 /// <inheritdoc/>
 public void SetAll(IoSessionConfig config)
 {
     if (config == null)
         throw new ArgumentNullException("config");
     ReadBufferSize = config.ReadBufferSize;
     SetIdleTime(IdleStatus.BothIdle, config.GetIdleTime(IdleStatus.BothIdle));
     SetIdleTime(IdleStatus.ReaderIdle, config.GetIdleTime(IdleStatus.ReaderIdle));
     SetIdleTime(IdleStatus.WriterIdle, config.GetIdleTime(IdleStatus.WriterIdle));
     ThroughputCalculationInterval = config.ThroughputCalculationInterval;
     DoSetAll(config);
 }
Example #19
0
 public FileConnector(IoSessionConfig sessionConfig) : base(sessionConfig)
 {
     idleStatusChecker = new IdleStatusChecker(() => ManagedSessions.Values);
 }
Example #20
0
 protected override void DoSetAll(IoSessionConfig config)
 {
     // Do nothing
 }
 protected AbstractSocketConnector(IoSessionConfig sessionConfig)
     : base(sessionConfig)
 {
     _processor = new AsyncSocketProcessor(() => ManagedSessions.Values);
 }
Example #22
0
 public DummyService(IoSessionConfig sessionConfig)
     : base(sessionConfig)
 {
 }
 protected abstract void DoSetAll(IoSessionConfig config);
Example #24
0
            public void SetAll(IoSessionConfig config)
            {
                if (config == null)
                    throw new ArgumentNullException("config");
                SetIdleTime(IdleStatus.BothIdle, config.GetIdleTime(IdleStatus.BothIdle));
                SetIdleTime(IdleStatus.ReaderIdle, config.GetIdleTime(IdleStatus.ReaderIdle));
                SetIdleTime(IdleStatus.WriterIdle, config.GetIdleTime(IdleStatus.WriterIdle));
                ThroughputCalculationInterval = config.ThroughputCalculationInterval;

                // other properties will be set in SerialConnector.Connect()
            }
Example #25
0
 protected abstract void DoSetAll(IoSessionConfig config);
 public SocketContext(System.Net.Sockets.Socket socket, IoSessionConfig config)
 {
     _socket       = socket;
     receiveBuffer = new Byte[config.ReadBufferSize];
 }
Example #27
0
 /// <summary>
 /// Instantiates.
 /// </summary>
 protected AbstractSocketConnector(IoSessionConfig sessionConfig)
     : base(sessionConfig)
 {
     _processor = new AsyncSocketProcessor(() => ManagedSessions.Values);
 }
Example #28
0
 /// <summary>
 /// </summary>
 protected AbstractIoConnector(IoSessionConfig sessionConfig)
     : base(sessionConfig)
 { }
 protected override void DoSetAll(IoSessionConfig config)
 {
     // do nothing
 }
Example #30
0
 /// <summary>
 /// </summary>
 protected AbstractIoAcceptor(IoSessionConfig sessionConfig)
     : base(sessionConfig)
 {
     _bindLock = ((ICollection)_boundEndPoints).SyncRoot;
 }
 public SocketContext(System.Net.Sockets.Socket socket, IoSessionConfig config)
 {
     _socket = socket;
     receiveBuffer = new Byte[config.ReadBufferSize];
 }