internal protected TcpServerChannel(TcpServerChannelManager channelManager, int channelId) : base(channelId) { if(channelManager == null) throw new ArgumentNullException("channelManager"); //设置通道管理器 _channelManager = channelManager; //初始化接受连接的时间 _acceptedTime = new DateTime(1900, 1, 1); }
internal protected TcpServerChannel(TcpServerChannelManager channelManager, int channelId) : base(channelId) { if (channelManager == null) { throw new ArgumentNullException("channelManager"); } //设置通道管理器 _channelManager = channelManager; //初始化接受连接的时间 _acceptedTime = new DateTime(1900, 1, 1); }
public TcpServer([TypeConverter(typeof(IPEndPointConverter))]IPEndPoint localEP) : base("TcpServer", localEP) { //创建接受异步事件参数 _acceptAsyncArgs = new SocketAsyncEventArgs(); //挂载接受异步事件参数的Completed事件处理委托 _acceptAsyncArgs.Completed += ((sender, asyncArgs) => { if(asyncArgs.LastOperation == SocketAsyncOperation.Accept) { this.OnAcceptCompleted(asyncArgs); } }); //创建当前服务器通道管理器 _channelManager = this.CreateChannelManager(); }
protected override void Dispose(bool disposing) { //停止当前服务 this.Stop(); if (disposing) { var channelManager = _channelManager; if (channelManager != null) { channelManager.Dispose(); } } //将通道管理器置空表示当前类已被处置 _channelManager = null; //调用基类同名方法 base.Dispose(disposing); }
public TcpServer([TypeConverter(typeof(IPEndPointConverter))]IPEndPoint address) : base("TcpServer") { if(address == null) throw new ArgumentNullException("address"); _address = address; //创建接受异步事件参数 _acceptAsyncArgs = new SocketAsyncEventArgs(); //挂载接受异步事件参数的Completed事件处理委托 _acceptAsyncArgs.Completed += ((sender, asyncArgs) => { if(asyncArgs.LastOperation == SocketAsyncOperation.Accept) { this.OnAcceptCompleted(asyncArgs); } }); //创建当前服务器通道管理器 _channelManager = this.CreateChannelManager(); }
public TcpServer([TypeConverter(typeof(IPEndPointConverter))] IPEndPoint address) : base("TcpServer") { if (address == null) { throw new ArgumentNullException("address"); } _address = address; //创建接受异步事件参数 _acceptAsyncArgs = new SocketAsyncEventArgs(); //挂载接受异步事件参数的Completed事件处理委托 _acceptAsyncArgs.Completed += ((sender, asyncArgs) => { if (asyncArgs.LastOperation == SocketAsyncOperation.Accept) { this.OnAcceptCompleted(asyncArgs); } }); //创建当前服务器通道管理器 _channelManager = this.CreateChannelManager(); }
protected override void Dispose(bool disposing) { //停止当前服务 this.Stop(); if(disposing) { var channelManager = _channelManager; if(channelManager != null) channelManager.Dispose(); } //将通道管理器置空表示当前类已被处置 _channelManager = null; //调用基类同名方法 base.Dispose(disposing); }
internal protected TcpServerChannel(TcpServerChannelManager channelManager, int channelId) : base(channelId, channelManager) { //初始化接受连接的时间 _acceptedTime = new DateTime(1900, 1, 1); }