using DotNetty.Buffers; using DotNetty.Transport.Channels; using log4net; namespace HybirdFrameworkServices.Netty; public class IoSession { private readonly ILog Log = LogManager.GetLogger(typeof(IoSession)); private IChannel Channel { get; } private String IpAddr { get; } public String Key { get; set; } private bool Reconnected { get; set; } public IoSession(IChannel channel) { this.Channel = channel; this.IpAddr = ChannelUtils.GetIp(channel); } public void Send(IByteBuffer buffer) { Channel.WriteAndFlushAsync(buffer); } public bool IsClosed() { return !Channel.Open || !Channel.Active; } public void Close() { Channel?.CloseAsync(); } }