public WService(ThreadSynchronizationContext threadSynchronizationContext, IEnumerable <string> prefixs) { this.ThreadSynchronizationContext = threadSynchronizationContext; this.httpListener = new HttpListener(); StartAccept(prefixs).Coroutine(); }
public TService(ThreadSynchronizationContext threadSynchronizationContext, ServiceType serviceType) { this.foreachAction = channelId => { TChannel tChannel = this.Get(channelId); tChannel?.Update(); }; this.ServiceType = serviceType; this.ThreadSynchronizationContext = threadSynchronizationContext; }
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); }
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); } }
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); } }
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); } }
public TService(ThreadSynchronizationContext threadSynchronizationContext, ServiceType serviceType) { this.ServiceType = serviceType; this.ThreadSynchronizationContext = threadSynchronizationContext; }
public static void Update() { ThreadSynchronizationContext.Update(); TimeInfo.Update(); EventSystem.Update(); }
public WService(ThreadSynchronizationContext threadSynchronizationContext) { this.ThreadSynchronizationContext = threadSynchronizationContext; }