java获取网络带宽_Linux Java 获取CPU使用率,内存使用率,磁盘IO,网络带宽使用率等等...

 /**

* 获取带宽上传下载速度

* @return

*/

public String getNetWorkSpeed() {

boolean result = false;

String detailInfo = "";

DecimalFormat df = new DecimalFormat("0.00");

String dl = "";

String ul = "";

System.out.println("开始收集网络带宽使用率");

Process pro1,pro2;

Runtime r = Runtime.getRuntime();

try {

String command = "cat /proc/net/dev";

//第一次采集流量数据

long startTime = System.currentTimeMillis();

pro1 = r.exec(command);

BufferedReader in1 = new BufferedReader(new InputStreamReader(pro1.getInputStream()));

String line = null;

long inSize1 = 0, outSize1 = 0;

while((line=in1.readLine()) != null){

line = line.trim();

if(line.startsWith("eth0")){

System.out.println(line);

String[] temp = line.split("\\s+");

inSize1 = Long.parseLong(temp[1]); //Receive bytes,单位为Byte

outSize1 = Long.parseLong(temp[9]); //Transmit bytes,单位为Byte

break;

}

}

in1.close();

pro1.destroy();

try {

Thread.sleep(1000);

} catch (InterruptedException e) {

StringWriter sw = new StringWriter();

e.printStackTrace(new PrintWriter(sw));

System.out.println("NetUsage休眠时发生InterruptedException. " + e.getMessage());

System.out.println(sw.toString());

}

//第二次采集流量数据

long endTime = System.currentTimeMillis();

pro2 = r.exec(command);

BufferedReader in2 = new BufferedReader(new InputStreamReader(pro2.getInputStream()));

long inSize2 = 0 ,outSize2 = 0;

while((line=in2.readLine()) != null){

line = line.trim();

if(line.startsWith("eth0")){

System.out.println(line);

String[] temp = line.split("\\s+");

inSize2 = Long.parseLong(temp[1]);

outSize2 = Long.parseLong(temp[9]);

break;

}

}

//cal dl speed

float interval = (float)(endTime - startTime)/1000;

float currentDlSpeed = (float) ((float)(inSize2 - inSize1)/1024/interval);

float currentUlSpeed = (float) ((float)(outSize2 - outSize1)/1024/interval);

if((float)(currentDlSpeed/1024) >= 1){

currentDlSpeed = (float)(currentDlSpeed/1024);

dl = df.format(currentDlSpeed) + "Mb/s";

}else{

dl = df.format(currentDlSpeed) + "Kb/s";

}

if((float)(currentUlSpeed/1024) >= 1){

currentUlSpeed = (float)(currentUlSpeed/1024);

ul = df.format(currentUlSpeed) + "Mb/s";

}else{

ul = df.format(currentUlSpeed) + "Kb/s";

}

result = true;

in2.close();

pro2.destroy();

} catch (Exception e) {

e.printStackTrace();

detailInfo = e.getMessage();

}

return "{\"result\":\""+result+"\",\"detailInfo\":\""+detailInfo+"\",\"dl\":\""+dl+"\",\"ul\":\""+ul+"\"}";

}

/**

* 功能:内存使用率

* */

public float memoryUsage() {

Map map = new HashMap();

InputStreamReader inputs = null;

BufferedReader buffer = null;

try {

inputs = new InputStreamReader(new FileInputStream("/proc/meminfo"));

buffer = new BufferedReader(inputs);

String line = "";

while (true) {

line = buffer.readLine();

if (line == null)

break;

int beginIndex = 0;

int endIndex = line.indexOf(":");

if (endIndex != -1) {

String key = line.substring(beginIndex, endIndex);

beginIndex = endIndex + 1;

endIndex = line.length();

String memory = line.substring(beginIndex, endIndex);

String value = memory.replace("kB", "").trim();

map.put(key, value);

}

}

long memTotal = Long.parseLong(map.get("MemTotal").toString());

long memFree = Long.parseLong(map.get("MemFree").toString());

long memused = memTotal - memFree;

long buffers = Long.parseLong(map.get("Buffers").toString());

long cached = Long.parseLong(map.get("Cached").toString());

float usage = (float) (memused - buffers - cached) / memTotal;

return usage;

} catch (Exception e) {

e.printStackTrace();

} finally {

try {

buffer.close();

inputs.close();

} catch (Exception e2) {

e2.printStackTrace();

}

}

return 0;

}

/**

* 获取分区的使用占用率

* @param path

* @return

*/

public float getPatitionUsage(String path){

File f = new File(path);

long total = f.getTotalSpace();

long free = f.getFreeSpace();

long used = total - free;

float usage = (float)used/total;

return usage;

}

/**

* 获取磁盘IO使用率

* @return

*/

public float getHdIOpPercent() {

System.out.println("开始收集磁盘IO使用率");

float ioUsage = 0.0f;

Process pro = null;

Runtime r = Runtime.getRuntime();

try {

String command = "iostat -d -x";

pro = r.exec(command);

BufferedReader in = new BufferedReader(new InputStreamReader(pro.getInputStream()));

String line = null;

int count = 0;

while((line=in.readLine()) != null){

if(++count >= 4){

// System.out.println(line);

String[] temp = line.split("\\s+");

if(temp.length > 1){

float util = Float.parseFloat(temp[temp.length-1]);

ioUsage = (ioUsage>util)?ioUsage:util;

}

}

}

if(ioUsage > 0){

System.out.println("本节点磁盘IO使用率为: " + ioUsage);

ioUsage /= 100;

}

in.close();

pro.destroy();

} catch (IOException e) {

StringWriter sw = new StringWriter();

e.printStackTrace(new PrintWriter(sw));

System.out.println("IoUsage发生InstantiationException. " + e.getMessage());

System.out.println(sw.toString());

}

return ioUsage;

}

/**

* 获取带宽使使用率

* @return

*/

public float get() {

float TotalBandwidth = 1000;

System.out.println("开始收集网络带宽使用率");

float netUsage = 0.0f;

Process pro1,pro2;

Runtime r = Runtime.getRuntime();

try {

String command = "cat /proc/net/dev";

//第一次采集流量数据

long startTime = System.currentTimeMillis();

pro1 = r.exec(command);

BufferedReader in1 = new BufferedReader(new InputStreamReader(pro1.getInputStream()));

String line = null;

long inSize1 = 0, outSize1 = 0;

while((line=in1.readLine()) != null){

line = line.trim();

if(line.startsWith("eth0")){

System.out.println(line);

String[] temp = line.split("\\s+");

inSize1 = Long.parseLong(temp[1].substring(5)); //Receive bytes,单位为Byte

outSize1 = Long.parseLong(temp[9]); //Transmit bytes,单位为Byte

break;

}

}

in1.close();

pro1.destroy();

try {

Thread.sleep(1000);

} catch (InterruptedException e) {

StringWriter sw = new StringWriter();

e.printStackTrace(new PrintWriter(sw));

System.out.println("NetUsage休眠时发生InterruptedException. " + e.getMessage());

System.out.println(sw.toString());

}

//第二次采集流量数据

long endTime = System.currentTimeMillis();

pro2 = r.exec(command);

BufferedReader in2 = new BufferedReader(new InputStreamReader(pro2.getInputStream()));

long inSize2 = 0 ,outSize2 = 0;

while((line=in2.readLine()) != null){

line = line.trim();

if(line.startsWith("eth0")){

System.out.println(line);

String[] temp = line.split("\\s+");

inSize2 = Long.parseLong(temp[1].substring(5));

outSize2 = Long.parseLong(temp[9]);

break;

}

}

if(inSize1 != 0 && outSize1 !=0 && inSize2 != 0 && outSize2 !=0){

float interval = (float)(endTime - startTime)/1000;

//网口传输速度,单位为bps

float curRate = (float)(inSize2 - inSize1 + outSize2 - outSize1)*8/(1000000*interval);

netUsage = curRate/TotalBandwidth;

System.out.println("本节点网口速度为: " + curRate + "Mbps");

System.out.println("本节点网络带宽使用率为: " + netUsage);

}

in2.close();

pro2.destroy();

} catch (IOException e) {

StringWriter sw = new StringWriter();

e.printStackTrace(new PrintWriter(sw));

System.out.println("NetUsage发生InstantiationException. " + e.getMessage());

System.out.println(sw.toString());

}

return netUsage;

}

/**

* 功能:可用磁盘

* */

public static int disk() {

try {

long total = FileSystemUtils.freeSpaceKb("/");

double disk = (double) total / 1024 / 1024;

return (int) disk;

} catch (IOException e) {

e.printStackTrace();

}

return 0;

}

/**

* 功能:获取Linux系统cpu使用率

* */

public static String cpuUsage() {

try {

Map, ?> map1 = SysStatusInfo.cpuinfo();

Thread.sleep(1 * 1000);

Map, ?> map2 = SysStatusInfo.cpuinfo();

long user1 = Long.parseLong(map1.get("user").toString());

long nice1 = Long.parseLong(map1.get("nice").toString());

long system1 = Long.parseLong(map1.get("system").toString());

long idle1 = Long.parseLong(map1.get("idle").toString());

long user2 = Long.parseLong(map2.get("user").toString());

long nice2 = Long.parseLong(map2.get("nice").toString());

long system2 = Long.parseLong(map2.get("system").toString());

long idle2 = Long.parseLong(map2.get("idle").toString());

long total1 = user1 + system1 + nice1;

long total2 = user2 + system2 + nice2;

float total = total2 - total1;

long totalIdle1 = user1 + nice1 + system1 + idle1;

long totalIdle2 = user2 + nice2 + system2 + idle2;

float totalidle = totalIdle2 - totalIdle1;

DecimalFormat df = new DecimalFormat(".0");

float cpusage = (float)(total / totalidle) * 100;

String value = df.format(cpusage);

return value;

} catch (InterruptedException e) {

e.printStackTrace();

}

return "0";

}

/**

* 功能:CPU使用信息

* */

public static Map, ?> cpuinfo() {

InputStreamReader inputs = null;

BufferedReader buffer = null;

Map map = new HashMap();

try {

inputs = new InputStreamReader(new FileInputStream("/proc/stat"));

buffer = new BufferedReader(inputs);

String line = "";

while (true) {

line = buffer.readLine();

if (line == null) {

break;

}

if (line.startsWith("cpu")) {

StringTokenizer tokenizer = new StringTokenizer(line);

List temp = new ArrayList();

while (tokenizer.hasMoreElements()) {

String value = tokenizer.nextToken();

temp.add(value);

}

map.put("user", temp.get(1));

map.put("nice", temp.get(2));

map.put("system", temp.get(3));

map.put("idle", temp.get(4));

map.put("iowait", temp.get(5));

map.put("irq", temp.get(6));

map.put("softirq", temp.get(7));

map.put("stealstolen", temp.get(8));

break;

}

}

} catch (Exception e) {

e.printStackTrace();

} finally {

try {

buffer.close();

inputs.close();

} catch (Exception e2) {

e2.printStackTrace();

}

}

return map;

}

int kb = 1024;

OperatingSystemMXBean osmxb = (OperatingSystemMXBean) ManagementFactory

.getOperatingSystemMXBean();

// 操作系统

String osName = System.getProperty("os.name");

// 总的物理内存

long totalMemorySize = osmxb.getTotalPhysicalMemorySize() / kb;

// 剩余的物理内存

long freePhysicalMemorySize = osmxb.getFreePhysicalMemorySize() / kb;

// 已使用的物理内存

long usedMemory = (osmxb.getTotalPhysicalMemorySize() - osmxb.getFreePhysicalMemorySize()) / kb;

/**

* 获取CPU使用率

* @return

*/

public float getCpuUsage() {

System.out.println("开始收集cpu使用率");

float cpuUsage = 0;

Process pro1,pro2;

Runtime r = Runtime.getRuntime();

try {

String command = "cat /proc/stat";

//第一次采集CPU时间

long startTime = System.currentTimeMillis();

pro1 = r.exec(command);

BufferedReader in1 = new BufferedReader(new InputStreamReader(pro1.getInputStream()));

String line = null;

long idleCpuTime1 = 0, totalCpuTime1 = 0; //分别为系统启动后空闲的CPU时间和总的CPU时间

while((line=in1.readLine()) != null){

if(line.startsWith("cpu")){

line = line.trim();

System.out.println(line);

String[] temp = line.split("\\s+");

idleCpuTime1 = Long.parseLong(temp[4]);

for(String s : temp){

if(!s.equals("cpu")){

totalCpuTime1 += Long.parseLong(s);

}

}

System.out.println("IdleCpuTime: " + idleCpuTime1 + ", " + "TotalCpuTime" + totalCpuTime1);

break;

}

}

in1.close();

pro1.destroy();

try {

Thread.sleep(100);

} catch (InterruptedException e) {

StringWriter sw = new StringWriter();

e.printStackTrace(new PrintWriter(sw));

System.out.println("CpuUsage休眠时发生InterruptedException. " + e.getMessage());

System.out.println(sw.toString());

}

//第二次采集CPU时间

long endTime = System.currentTimeMillis();

pro2 = r.exec(command);

BufferedReader in2 = new BufferedReader(new InputStreamReader(pro2.getInputStream()));

long idleCpuTime2 = 0, totalCpuTime2 = 0; //分别为系统启动后空闲的CPU时间和总的CPU时间

while((line=in2.readLine()) != null){

if(line.startsWith("cpu")){

line = line.trim();

System.out.println(line);

String[] temp = line.split("\\s+");

idleCpuTime2 = Long.parseLong(temp[4]);

for(String s : temp){

if(!s.equals("cpu")){

totalCpuTime2 += Long.parseLong(s);

}

}

System.out.println("IdleCpuTime: " + idleCpuTime2 + ", " + "TotalCpuTime" + totalCpuTime2);

break;

}

}

if(idleCpuTime1 != 0 && totalCpuTime1 !=0 && idleCpuTime2 != 0 && totalCpuTime2 !=0){

cpuUsage = 1 - (float)(idleCpuTime2 - idleCpuTime1)/(float)(totalCpuTime2 - totalCpuTime1);

System.out.println("本节点CPU使用率为: " + cpuUsage);

}

in2.close();

pro2.destroy();

} catch (IOException e) {

StringWriter sw = new StringWriter();

e.printStackTrace(new PrintWriter(sw));

System.out.println("CpuUsage发生InstantiationException. " + e.getMessage());

System.out.println(sw.toString());

}

return cpuUsage;

}

获取MAC

Windows

/**

* 获取MAC地址

*

* @return

*/

public String getMac() {

NetworkInterface byInetAddress;

try {

InetAddress localHost = InetAddress.getLocalHost();

byInetAddress = NetworkInterface.getByInetAddress(localHost);

byte[] hardwareAddress = byInetAddress.getHardwareAddress();

return getMacFromBytes(hardwareAddress);

} catch (SocketException e) {

// TODO Auto-generated catch block

e.printStackTrace();

System.out.println(getLocalTime()+"获取mac地址失败:" + e.getMessage());

} catch (UnknownHostException e) {

// TODO Auto-generated catch block

e.printStackTrace();

System.out.println(getLocalTime()+"获取mac地址失败:" + e.getMessage());

} catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

System.out.println(getLocalTime()+"获取mac地址失败:" + e.getMessage());

}

return null;

}

public String getMacFromBytes(byte[] bytes) {

StringBuffer mac = new StringBuffer();

byte currentByte;

boolean first = false;

for (byte b : bytes) {

if (first) {

mac.append("-");

}

currentByte = (byte) ((b & 240) >> 4);

mac.append(Integer.toHexString(currentByte));

currentByte = (byte) (b & 15);

mac.append(Integer.toHexString(currentByte));

first = true;

}

return mac.toString().toLowerCase();

}

Linux

/**

* 获取MAC

*

* @return

*/

public String getMac() {

String result = "";

try {

Enumeration networkInterfaces = NetworkInterface

.getNetworkInterfaces();

while (networkInterfaces.hasMoreElements()) {

NetworkInterface network = networkInterfaces.nextElement();

System.out.println("network : " + network);

byte[] mac = network.getHardwareAddress();

if (mac == null) {

System.out.println("null mac");

} else {

System.out.print("MAC address : ");

StringBuilder sb = new StringBuilder();

for (int i = 0; i < mac.length; i++) {

sb.append(String.format("%02X%s", mac[i],

(i < mac.length - 1) ? ":" : ""));

}

result = sb.toString();

System.out.println(sb.toString());

break;

}

}

} catch (SocketException e) {

e.printStackTrace();

}

return result;

}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/563476.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

java周期_java 周期时期计算

package org.apple.date;import java.text.SimpleDateFormat;import java.util.Calendar;import java.util.Date;/*** 周期时间* author shaoyu**/public class CycleDate {public static void main(String[] args) {SimpleDateFormat dateformatnew SimpleDateFormat("yy…

python实现qq登录界面_使用Python编写一个QQ办公版的图形登录界面!

最近&#xff0c;QQ的办公版本——TIM进行了一次更新升级。本次更新升级大幅修改了界面的样式&#xff0c;看起来更加的清爽、简洁和高效了。这种界面州的先生还是比较喜欢的&#xff0c;没有QQ那么花里胡哨&#xff0c;也比微信那些残缺的功能更加丰富。并且这次的登录界面还新…

python算法详解豆瓣_豆瓣爬虫实践-python版

豆瓣登录&#xff0c;无验证码版&#xff1a;import requests#starturl "https://www.douban.com/accounts/login"loginurl "https://accounts.douban.com/login"headers {User-Agent:Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KH…

python项目打包部署到ios_Python iOS 自动打包脚本(包含上传到fir)

Python iOS自动打包脚本使用说明1.1 使用python3编写&#xff0c;没有python3 环境的需要下载python3python官网下载1.2 通过Homebrew安装Python31.2.1 先搜索$ brew search python输出&#xff1a;app-engine-python micropython python3boost-python python wxpythongst-pyth…

stlink 升级固件以后失败_ST-Link不能下载程序的几种解决办法

一直在用J-LINK&#xff0c;最近改用ST-Link&#xff0c;出现了不少无法下载程序的情况&#xff0c;这里列出几种解决的办法(针对STM32F103系列)&#xff1a;1#是不是你没有选择Flash算法&#xff1f;什么都没有加的话&#xff0c;会提示“找不到Flash算法”的哦2#是不是你JTAG…

cnsl是什么意思_VS2010下创建静态链接库和动态链接库

VS2010下创建静态链接库和动态链接库类封装成dll如果你的工作长期与某个领域相关&#xff0c;比如说长期做直接体绘制 (DVR)方面的开发&#xff0c;那么你可能经常使用自己的传递函数类&#xff0c;如果每一个工程你都把传递函数类的.h和.cpp文件添加进去会比较麻烦&#xff0c…

java hash取余_为什么Java的hash表的长度一直是2的指数次幂?为什么这个(hash(h-1)=hash%h)位运算公式等价于取余运算?...

1.什么是hash表&#xff1f;答&#xff1a;简单回答散列表&#xff0c;在hash结构散列(分散)存放的一种数据集结构。2.如何散列排布&#xff0c;如何均匀排布&#xff1f;答&#xff1a;取余运算3.Java中如何实现&#xff1f;答&#xff1a;hash&(h-1)4.为什么hash&(h-…

java .net 3des_Java.net3DES差异及互通

主要差异如下&#xff1a;1、 对于待加密解密的数据&#xff0c;各自的填充模式不一样C#的模式有&#xff1a;ANSIX923、ISO10126、None、PKCS7、Zero&#xff0c;而Java有&#xff1a;NoPadding、PKCS5Padding、SSL3Padding2、 各自默认的3DES实现&#xff0c;模式和填充方式…

生产调度java程序原码_Rxjava的线程调度源码解析

代码调用Observable.just(1).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer() {Overridepublic void accept(Integer integer) throws Exception {}});直接进入主题&#xff0c;先看subscribe中调用了哪些方法//Observable.…

linux 触摸屏测试源码_Linux触摸屏驱动

问题二&#xff1a;echo "ac_cv_func_malloc_0_nonnullyes" >arm-linux.cache//避免检查ac_cv_func_malloc_0_nonnull若出现提示: undefined reference to rpl_malloc解决&#xff1a;发现config.h.in和config.h里定义了#undef malloc#undef realloc把这两个用//注…

java有没有number数据类型_Java基本数据类型之Number

数据类型byte&#xff1a;byte数据类型是8位、有符号的&#xff0c;以二进制补码表示的整数&#xff1b;最小值是-128(-2^7)&#xff1b;最大值是127(2^7-1)&#xff1b;byte类型用在大型数组中节约空间&#xff0c;主要代替整数&#xff0c;因为byte变量占用的空间只有int类型…

java中main缺少主体_缺少方法主体,或声明了摘要

我收到此错误消息&#xff1a;线程“主”中的异常java.lang.RuntimeException&#xff1a;无法编译的源代码-错误的符号类型&#xff1a;PetTest.main(PetTest.java:18)上的Pet.saySomething Java结果&#xff1a;1这是我所拥有的&#xff1a;对于Speak课堂&#xff0c;public …

java获取b站动态列表地址_爬虫入门(三)爬取b站搜索页视频分析(动态页面,DBUtils存储)...

这一次终于到了分析b站视频了。开始体会到写博客非常占用学技术的时间&#xff0c;但是还是希望能总结&#xff0c;沉淀下来。工具&#xff1a;使用Webmaigc框架&#xff0c;DBUtils&#xff0c;C3P0连接池。分析过程&#xff1a;b站的搜索页面是这样的。如果浏览器右键查看源代…

python a和b字符串和占位符输出_Python占位符的使用与format函数字符串格式化详解...

Python字符串格式化01字符串的格式化分类字符串的格式化方法共两种&#xff1a;占位符(%)与format方式。占位符方式在Python2比较常见&#xff0c;随着Python3到来&#xff0c;format方式变得广泛起来&#xff0c;format函数常与print()函数结合使用&#xff0c;具备很强的格式…

python list tuple 消耗_Python内存消耗:dict VS元组列表

在这种情况下&#xff0c;你实际上得到了一个不完整的内存使用图片。字典的总大小以不规则的间隔增加一倍以上&#xff0c;如果在字典大小增加后比较这两个结构的大小&#xff0c;它会再次变大。一个带有递归大小函数的简单脚本(见下面的代码)显示了一个非常清晰的模式&#xf…

python 项目构建工具_GitHub - shjlone/emake: 你见过的最简单的 GCC/CLANG 项目构建工具(python3版本)...

python3实现版本PrefaceGNU Make 太麻烦&#xff1f;Makefile 写起来太臃肿&#xff1f;头文件依赖生成搞不定&#xff1f;多核同时编译太麻烦&#xff1f;Emake 帮你解决这些问题&#xff1a;使用简单&#xff1a;设定源文件&#xff0c;设定编译参数和输出目标就行了&#xf…

18135usm_佳能PZ-E1+EF-S 18-135mm f/3.5-5.6 IS USM镜头 小型工作室的利器

EF-S 18-135mm f/3.5-5.6 IS USM 在大神眼里据对是属于狗头系列的 哈哈哈 但是这货如果搭配佳能的 PZ-E1 在配合佳能80D 那绝对是小型视频工作室的首选 &#xff01;&#xff01;&#xff01;mxcpTB2rqUOg80kpuFjSsppXXcGTXXa_!!104284319.jpg (156.5 KB, 下载次数: 1)2017-3-…

开启php缩略图,PHP生成缩略图

//参数1 文件名 参数2 缩放比例function _thumb($_filename,$_percent){ob_clean();//生成png标头文件header(Content-type:image/png);$_nexplode(., $_filename);//获取文件的信息,宽和高list($_width,$_height)getimagesize($_filename);//生成缩略后的大小$_new_wid…

php项目中sql,php – 大括号{}在SQL查询中做了什么?

有关双引号字符串语法,请参见http://www.php.net/manual/de/language.types.string.php#language.types.string.parsing.花括号用于复杂的变量表达式.它们由PHP解释,而不是由SQL接口解释.$query "SELECT * FROM users WHERE user$_POST[username] AND password$_POST[pas…

php获取本机ip外网地址,php获取本机ip(远程IP地址)

例子&#xff0c;php获取用户IP地址。复制代码 代码示例:// 111111111111echo $_SERVER[REMOTE_ADDR];// 2222222222222function get_local_ip() {$preg "/\A((([0-9]?[0-9])|(1[0-9]{2})|(2[0-4][0-9])|(25[0-5]))\.){3}(([0-9]?[0-9])|(1[0-9]{2})|(2[0-4][0-9])|(25…