コード例 #1
0
        public WService(ThreadSynchronizationContext threadSynchronizationContext, IEnumerable <string> prefixs)
        {
            this.ThreadSynchronizationContext = threadSynchronizationContext;

            this.httpListener = new HttpListener();

            StartAccept(prefixs).Coroutine();
        }
コード例 #2
0
 public TService(ThreadSynchronizationContext threadSynchronizationContext, ServiceType serviceType)
 {
     this.foreachAction = channelId =>
     {
         TChannel tChannel = this.Get(channelId);
         tChannel?.Update();
     };
     this.ServiceType = serviceType;
     this.ThreadSynchronizationContext = threadSynchronizationContext;
 }
コード例 #3
0
        public TService(ThreadSynchronizationContext threadSynchronizationContext, IPEndPoint ipEndPoint, ServiceType serviceType)
        {
            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);
        }
コード例 #4
0
ファイル: KService.cs プロジェクト: x00568/ET
        public KService(ThreadSynchronizationContext threadSynchronizationContext, AddressFamily addressFamily, ServiceType serviceType)
        {
            this.ServiceType = serviceType;
            this.ThreadSynchronizationContext = threadSynchronizationContext;
            this.startTime = TimeHelper.ClientNow();
            this.socket    = new Socket(addressFamily, SocketType.Dgram, ProtocolType.Udp);

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                const uint IOC_IN            = 0x80000000;
                const uint IOC_VENDOR        = 0x18000000;
                uint       SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12;
                this.socket.IOControl((int)SIO_UDP_CONNRESET, new[] { Convert.ToByte(false) }, null);
            }
        }
コード例 #5
0
        public KService(ThreadSynchronizationContext threadSynchronizationContext, ServiceType serviceType)
        {
            this.ServiceType = serviceType;
            this.ThreadSynchronizationContext = threadSynchronizationContext;
            this.StartTime = TimeHelper.ClientNow();
            this.socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            // 作为客户端不需要修改发送跟接收缓冲区大小
            this.socket.Bind(new IPEndPoint(IPAddress.Any, 0));

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                const uint IOC_IN = 0x80000000;
                const uint IOC_VENDOR = 0x18000000;
                uint SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12;
                this.socket.IOControl((int) SIO_UDP_CONNRESET, new[] { Convert.ToByte(false) }, null);
            }
        }
コード例 #6
0
ファイル: KService.cs プロジェクト: yangjiayuGIT/ET
 public KService(ThreadSynchronizationContext threadSynchronizationContext, IPEndPoint ipEndPoint, ServiceType serviceType)
 {
     this.ServiceType = serviceType;
     this.ThreadSynchronizationContext = threadSynchronizationContext;
     this.StartTime = TimeHelper.ClientNow();
     this.socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
     this.socket.SendBufferSize = Kcp.OneM * 64;
     this.socket.ReceiveBufferSize = Kcp.OneM * 64;
     this.socket.Bind(ipEndPoint);
     if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
     {
         const uint IOC_IN = 0x80000000;
         const uint IOC_VENDOR = 0x18000000;
         uint SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12;
         this.socket.IOControl((int) SIO_UDP_CONNRESET, new[] { Convert.ToByte(false) }, null);
     }
 }
コード例 #7
0
 public TService(ThreadSynchronizationContext threadSynchronizationContext, ServiceType serviceType)
 {
     this.ServiceType = serviceType;
     this.ThreadSynchronizationContext = threadSynchronizationContext;
 }
コード例 #8
0
 public static void Update()
 {
     ThreadSynchronizationContext.Update();
     TimeInfo.Update();
     EventSystem.Update();
 }
コード例 #9
0
 public WService(ThreadSynchronizationContext threadSynchronizationContext)
 {
     this.ThreadSynchronizationContext = threadSynchronizationContext;
 }