using System;
using System.Globalization;
using System.Net;

namespace StandardScene.TCP
{
    /// <summary>
    /// 与服务器的连接已建立事件
    /// </summary>
    public class TcpServerConnectedEventArgs : EventArgs
    {
        public TcpServerConnectedEventArgs(IPAddress ipAddress, int port)
        {
            if (ipAddress == null)
            {
                throw new ArgumentNullException("ipAddress");
            }
            this.Address = ipAddress;
            this.Port = port;
        }

        public IPAddress Address { get; private set; }

        public int Port { get; private set; }

        public override string ToString()
        {
            return this.Address + ":" + this.Port.ToString(CultureInfo.InvariantCulture);
        }
    }
}