Ejemplo n.º 1
0
        /// <summary>
        /// Initializes
        /// </summary>
        /// <param name="ep"></param>
        /// <param name="strategy"></param>
        public EndPointHostBase(EndPoint ep, LogicOfTo <string, string> logic = null)
            : base()
        {
            Condition.Requires(ep).IsNotNull();

            //validate the ep is within the current ip list
            var ips = NetUtil.GetLocalIPAddresses();

            Condition.Requires(ips).Contains(ep.IPAddress);

            this.EndPoint = ep;
            this.Logic    = logic;
        }
Ejemplo n.º 2
0
        public static EndPoint NewFreeLocalEndPointSpecifyingPort(int port)
        {
            var ip = NetUtil.GetLocalIPAddresses().FirstOrDefault();

            return(new EndPoint(ip, port));
        }
Ejemplo n.º 3
0
        public static EndPoint NewFreeLoopbackEndPoint()
        {
            int port = NetUtil.GetFreeTcpPort(System.Net.IPAddress.Loopback);

            return(new EndPoint(System.Net.IPAddress.Loopback, port));
        }