On Thu, 28 Jul 2016 10:26:32 +0200 Jonas Maebe <jonas.ma...@elis.ugent.be> wrote:
> On 28/07/16 10:14, Koenraad Lelong wrote: > > I need a way to test if an string containing an ipv4-address is really > > an ipv4-address. > > I tried > > tmpAddress:=HostAddrToStr(StrToHostAddr(IPAddressStr)); > > writeln(tmpAddress); > > if (tmpAddress='0.0.0.0') then > > begin > > writeln('Error in IP-address'); > > IPAddressStr:=tmpAddress; > > end; > > When I enter 192.168.185.297 (i.e. not a valid ipv4 address) in > > IPAddressStr I get > > 192.168.185.41 > > not the expected error-message. > > You can add a multiple of 256 to any octet of an IPv4 address in most > programs. Try it in your browser, it will probably also work. What browser supports that? Mattias _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal