Example #1
0
 public override void Update()
 {
     foreach (long channelId in this.NeedStartSend)
     {
         TChannel tChannel = this.Get(channelId);
         tChannel?.Update();
     }
     this.NeedStartSend.Clear();
 }
Example #2
0
 public TService(ThreadSynchronizationContext threadSynchronizationContext, ServiceType serviceType)
 {
     this.foreachAction = channelId =>
     {
         TChannel tChannel = this.Get(channelId);
         tChannel?.Update();
     };
     this.ServiceType = serviceType;
     this.ThreadSynchronizationContext = threadSynchronizationContext;
 }
Example #3
0
        public TService(ThreadSynchronizationContext threadSynchronizationContext, IPEndPoint ipEndPoint, ServiceType serviceType)
        {
            this.foreachAction = channelId =>
            {
                TChannel tChannel = this.Get(channelId);
                tChannel?.Update();
            };

            this.ServiceType = serviceType;
            this.ThreadSynchronizationContext = threadSynchronizationContext;

            this.acceptor = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            this.acceptor.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
            this.innArgs.Completed += this.OnComplete;
            this.acceptor.Bind(ipEndPoint);
            this.acceptor.Listen(1000);

            this.ThreadSynchronizationContext.PostNext(this.AcceptAsync);
        }