Leading zeros in an IP octet indicate octal.
If you ping 192.168.077.1 from both Linux and Windows you get
ping 192.168.077.1 PING 192.168.077.1 (192.168.63.1) 56(84) bytes of data.
Note how it converted 077 to 63. The problem seems to be is that apart from the name, there is nothing
On 25.02.2016 16:40, james wrote: that would guide the interpretation of the leading zeroes in dot-*decimal* notation for IPv4 addresses. For instance, while ping on my Mac agrees with the octal interpretation, nslookup doesn't::
192.168.077.1 Server: 192.168.3.1 Address: 192.168.3.1#53
Name: 192.168.077.1 Address: 192.168.77.1 Regardless, the ambiguity seems stronger than what I initially thought. Cheers, Leon
James
On Thu, Feb 25, 2016 at 1:20 PM, Mark R Stallard
mailto:stallard@raytheon.com> wrote: John Davies
mailto:john.davies@philips.com> wrote: > If my address is 192.168.1.112 everything works > If my address is 192.168.001.112 it doesn’t work and throws an exception > about not finding the host. > > It’s not a big deal, but it sure took me a long time to track down. > > Is there some sort of Boost magic I can do to convert the bad address > into a good address?
If you still need to remove leading zeroes from the address, consider using Boost.Regex (or stdlib regex if you have a C++11 toolset).
The regular expression "\b0+(?=[1-9])" will match one or more leading zeroes that precede a non-zero digit. Replace each match with an empty string.
|+| M a r k |+|
*Mark Stallard* Business Application Services Global Business Services Information Technology* Raytheon Company*
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org mailto:Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users