private void button1_Click(object sender, EventArgs e)
{
string StartIp = "";
string EndIp = "";
StartIp = Startinput.Text;
EndIp = Endinput.Text;
uint iStartip = ipTint(StartIp);
uint iEndIp = ipTint(EndIp);
//string ip_result="";
StringBuilder ip_result=new StringBuilder();
if (iEndIp >= iStartip)
{
for (uint ip = iStartip; ip <= iEndIp; ip++)
{
ip_result.Append(intTip(ip)).Append("\r\n");
//ip_result = ip_result + intTip(ip)+"\r\n";
}
resultTextBox.Text = ip_result.ToString(); //RichTextBox
}
else
{
MessageBox.Show("天啊,起始ip居然比终止ip还大");
}
}
public static uint ipTint(string ipStr)
{
string[] ip = ipStr.Split('.');
uint ipcode = 0xFFFFFF00 | byte.Parse(ip[]);
ipcode = ipcode & 0xFFFF00FF | (uint.Parse(ip[]) << 0x8);
ipcode = ipcode & 0xFF00FFFF | (uint.Parse(ip[]) << 0xF);
ipcode = ipcode & 0x00FFFFFF | (uint.Parse(ip[]) << 0x18);
return ipcode;
}
public static string intTip(uint ipcode)
{
byte a = (byte)((ipcode & 0xFF000000) >> 0x18);
byte b = (byte)((ipcode & 0x00FF0000) >> 0xF);
byte c = (byte)((ipcode & 0x0000FF00) >> 0x8);
byte d = (byte)(ipcode & 0x000000FF);
string ipStr = string.Format("{0}.{1}.{2}.{3}", a, b, c, d);
return ipStr;
}

C# 指定ip段生成ip地址的更多相关文章

  1. C# 输入ip段生成ip地址

    具体代码如下: private void button1_Click(object sender, EventArgs e)        {            string StartIp = ...

  2. ip效验和ip段的效验

      package com.juchen.utils; import javax.servlet.http.HttpServletRequest; /** * ip 相关的工具方法 */ public ...

  3. python3通过纯真IP数据库查询IP归属地信息

    在网上看到的别人写的python2的代码,修改成了python3. 把纯真IP数据库文件qqwry.dat放到czip.py同一目录下. #! /usr/bin/env python # -*- co ...

  4. 批量屏蔽符合条件的IP地址,支持添加白名单,IP段,增量,大于指定次数的IP

    批量屏蔽符合条件的IP地址,支持添加白名单,IP段,增量 大概的思路是利用sh,从日志中提取出来对应的IP地址,然后再交由python进行对比,判断,最终将需要添加至iptables列表中的IP写入到 ...

  5. linux编写脚本检测本机链接指定IP段是否畅通

    linux编写脚本检测本机链接指定IP段是否畅通,通过ping命令检测指定IP,检测命令执行结果,若为0表示畅通,若为1表示不通,以此判断网络是否畅通,但是指定机器禁用ping命令除外.代码如下: # ...

  6. 制定ip池内随机生成ip地址

    ]) { +] = {}; unsigned mask = 0x0; sscanf(ip_pool, "%[^/]/%d", ip_addr, &mask); long l ...

  7. Oracle 使用sqlnet.ora/trigger限制/允许某IP或IP段访问指定用户

    Oracle 使用sqlnet.ora/trigger限制/允许某IP或IP段访问指定用户 学习了:http://blog.itpub.net/28602568/viewspace-2092858/ ...

  8. [转帖]Oracle 使用sqlnet.ora/trigger限制/允许某IP或IP段访问指定用户

    Oracle 使用sqlnet.ora/trigger限制/允许某IP或IP段访问指定用户 原创 Oracle 作者:maohaiqing0304 时间:2016-05-03 17:05:46  17 ...

  9. 手机号段、ip地址归属地大全,最新手机号段归属地,IP地址归属地数据库

    百事通:http://www.114best.com/dh/114.aspx?w=17097232323,联通识别为电信的,1349错 二三四五:http://tools.2345.com/frame ...

随机推荐

  1. 将String转换成InputStream

    String   str   =   "";//add   your   string   contentInputStream   inputStream   =   new   ...

  2. 非网络引用element-ui css导致图标无法正常显示的解决办法

    https://blog.csdn.net/m0_37893932/article/details/79460652 ***************************************** ...

  3. BeautifulSoup 使用select方法详解(通过标签名,类名, id,组合,属性查找)

    import requestsfrom bs4 import BeautifulSoup blslib="html5lib"user_agent="Mozilla/5.0 ...

  4. 如何在wpf实现进度条

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; u ...

  5. centos 7 64安装mongodb

    官网连接地址:https://www.mongodb.com/download-center?jmp=nav#community 列表中没有CentOS!!我选的是这个Linux 64-bit leg ...

  6. Linux 使用tty0 显示10分钟自动关闭功能

    如果用屏幕显示控制台,10分钟左右会自动关闭,有如下方法可以解决 在应用层调用如下代码: #include <fcntl.h> #include <stdio.h> #incl ...

  7. adc 测量子系统

    #include <stdio.h>        #include <stdlib.h>         #include <fcntl.h>         # ...

  8. CDH版本java开发环境搭建

    1. maven设置 除了阿里云库,还需要引入 cdh, spring库.需要修改maven下面的配置文件setting.xml, 参考下面设置. <mirror> <!--This ...

  9. String Format for Double [C#]

    转载:http://www.csharp-examples.net/string-format-double/ he following examples show how to format flo ...

  10. sql分页存储过程比较

    一,先创建一百万条数据 drop table #tmp create table #tmp ( id ,) primary key, name ) ) declare @i int begin ins ...