예제 #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;
 }