public static EndPoint NewFreeLocalEndPoint() { var ip = NetUtil.GetLocalIPAddresses().FirstOrDefault(); var port = NetUtil.GetFreeTcpPort(ip); return(new EndPoint(ip, port)); }
public static EndPoint NewFreeLocalEndPoint(int adapterIndex) { var ip = NetUtil.GetLocalIPAddresses()[adapterIndex]; var port = NetUtil.GetFreeTcpPort(ip); return(new EndPoint(ip, port)); }
/// <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; }
public static EndPoint NewFreeLocalEndPointSpecifyingPort(int port) { var ip = NetUtil.GetLocalIPAddresses().FirstOrDefault(); return(new EndPoint(ip, port)); }