using System;
using Top.Api;
namespace Taobao.Top.Link.Channel
{
    /// the channel that server bound
    /// 
    public abstract class ServerChannel
    {
        protected ITopLogger Logger { get; private set; }
        /// get server address
        /// 
        protected int Port { get; private set; }
        /// get or set connection max idle time that do not send or receive
        /// 
        public int MaxIdleTimeSeconds { get; set; }
        /// while message received on this channel
        /// 
        public EventHandler OnMessage { get; set; }
        /// while error occur on this channel
        /// 
        public EventHandler OnError { get; set; }
        public ServerChannel(ITopLogger logger, int port)
        {
            this.Logger = logger;
            this.Port = port;
        }
        /// start server
        /// 
        public abstract void Start();
        /// stop server
        /// 
        public abstract void Stop();
    }
}