Ejemplo n.º 1
0
        /// <summary>
        /// IP 文字列を返す
        /// </summary>
        /// <param name="ip"></param>
        /// <param name="ofst"></param>
        /// <returns></returns>
        public static string toIPstr(string ip, int ofst)
        {
            if (string.IsNullOrWhiteSpace(ip))
            {
                return("---");
            }

            byte[] bf = IPAddress.Parse(ip).GetAddressBytes();
            UInt32 p  = BFF.getDWordB(bf, 0);

            p += (UInt32)ofst;
            BFF.setDWordB(bf, 0, p);

            return(new IPAddress(bf).ToString());
        }
Ejemplo n.º 2
0
        public static IPEndPoint CreateEndPoint(string ip, int port, int ofst = 0)
        {
            if (string.IsNullOrWhiteSpace(ip))
            {
                return(new IPEndPoint(IPAddress.Any, port));
            }

            byte[] bf = IPAddress.Parse(ip).GetAddressBytes();
            UInt32 p  = BFF.getDWordB(bf, 0);

            p += (UInt32)ofst;
            BFF.setDWordB(bf, 0, p);

            return(new IPEndPoint(new IPAddress(bf), port));
        }