/// <summary>
/// ip地址,网络字节序,long类型
/// </summary>
/// <param name="ipmsg">文件名</param>
public long IpChange(string ipmsg)
{
char[] separator = new char[] { '.' };
string[] items = ipmsg.Split(separator);
long dreamduip = long.Parse(items[0]) << 24
| long.Parse(items[1]) << 16
| long.Parse(items[2]) << 8
| long.Parse(items[3]);
long sun = System.Net.IPAddress.HostToNetworkOrder(dreamduip);
return sun;
}
C#将ip地址转换为网络字节序的long类型
最新推荐文章于 2021-12-05 00:38:24 发布