ruby - How to increment the last octet in an IP address -
How to write a Ruby Auxiliary function that will increase from 222.164.153.58 to 222.164.153.59
or the third octet On max hit, increase the 3 octet properly.
Required "ipaddr" addr = IPAddr.new "222.164.153.58" addr.succ # = & gt; # & Lt; IPAddr: IPv4: 222.164.153.5 9 / 255.255.255.255 & gt; Addr = IPAddr.new "192.168.2.255" addr.succ # = & gt; # & Lt; IPAddr: IPv4: 192.168.3.0/255.255.255.255>
Comments
Post a Comment