using System; using System.Net; namespace Sodao.FastSocket.SocketBase { /// /// a connection interface. /// public interface IConnection { /// /// disconnected event /// event DisconnectedHandler Disconnected; /// /// return the connection is active. /// bool Active { get; } /// /// get the connection latest active time. /// DateTime LatestActiveTime { get; } /// /// get the connection id. /// long ConnectionID { get; } /// /// 获取本地IP地址 /// IPEndPoint LocalEndPoint { get; } /// /// 获取远程IP地址 /// IPEndPoint RemoteEndPoint { get; } /// /// 获取或设置与用户数据 /// object UserData { get; set; } /// /// 异步发送数据 /// /// void BeginSend(Packet packet); /// /// 异步接收数据 /// void BeginReceive(); /// /// 异步断开连接 /// /// void BeginDisconnect(Exception ex = null); } }