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;
            }
예제 #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;
 }
예제 #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;
            }
예제 #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;
            }
        }
예제 #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;
 }
예제 #9
0
 /// <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);
 }
예제 #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()
            }
예제 #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);
 }
예제 #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);
 }
예제 #13
0
        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;
        }
예제 #15
0
 /// <summary>
 /// </summary>
 protected AbstractIoService(IoSessionConfig sessionConfig)
 {
     _sessionConfig = sessionConfig;
     _handler       = new InnerHandler(this);
     _stats         = new IoServiceStatistics(this);
 }
예제 #16
0
 /// <summary>
 /// </summary>
 protected AbstractIoConnector(IoSessionConfig sessionConfig)
     : base(sessionConfig)
 {
 }
예제 #17
0
 protected AbstractIoAcceptor(IoSessionConfig sessionConfig)
     : base(sessionConfig)
 { 
     _bindLock = ((ICollection)_boundEndPoints).SyncRoot;
 }
예제 #18
0
 /// <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);
 }
예제 #19
0
 public FileConnector(IoSessionConfig sessionConfig) : base(sessionConfig)
 {
     idleStatusChecker = new IdleStatusChecker(() => ManagedSessions.Values);
 }
예제 #20
0
 protected override void DoSetAll(IoSessionConfig config)
 {
     // Do nothing
 }
 protected AbstractSocketConnector(IoSessionConfig sessionConfig)
     : base(sessionConfig)
 {
     _processor = new AsyncSocketProcessor(() => ManagedSessions.Values);
 }
예제 #22
0
 public DummyService(IoSessionConfig sessionConfig)
     : base(sessionConfig)
 {
 }
예제 #23
0
 protected abstract void DoSetAll(IoSessionConfig config);
예제 #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()
            }
예제 #25
0
 protected abstract void DoSetAll(IoSessionConfig config);
예제 #26
0
 public SocketContext(System.Net.Sockets.Socket socket, IoSessionConfig config)
 {
     _socket       = socket;
     receiveBuffer = new Byte[config.ReadBufferSize];
 }
예제 #27
0
 /// <summary>
 /// Instantiates.
 /// </summary>
 protected AbstractSocketConnector(IoSessionConfig sessionConfig)
     : base(sessionConfig)
 {
     _processor = new AsyncSocketProcessor(() => ManagedSessions.Values);
 }
예제 #28
0
 /// <summary>
 /// </summary>
 protected AbstractIoConnector(IoSessionConfig sessionConfig)
     : base(sessionConfig)
 { }
 protected override void DoSetAll(IoSessionConfig config)
 {
     // do nothing
 }
예제 #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];
 }