Re: TIdNetworkCalculator in Indy 10.2.3 is upside down

Giganews Newsgroups
Subject: Re: TIdNetworkCalculator in Indy 10.2.3 is upside down
Posted by:  topmop (topm…@gmail.com)
Date: Tue, 4 Sep 2007

The problem i mentioned is not specific to NetworkMask, Same problem exist for NetworkAddress as both use same functions in source.

I tried to find out where the things are going in reverse but did not really find the exact point. But for now i made IsAddressInNetwork()  work for me by doing below changes in IDNetworkCalculator.pas .

---In
procedure TIdLongWordIP.SetByte(Index: Integer; const Value: Byte);
---Changed the last line from
  Result := OrdFourByteToLongWord(cardBuffers[0], cardBuffers[1], cardBuffers[3], cardBuffers[3]);
---to
  Result := OrdFourByteToLongWord(cardBuffers[3], cardBuffers[2], cardBuffers[1], cardBuffers[0]);

---In
function TIpProperty.GetAsString: String;
---Changed the last line from
Result := IndyFormat('%d.%d.%d.%d', [FValue.s_b1, FValue.s_b2, FValue.s_b3, FValue.s_b4]);
---to
Result := IndyFormat('%d.%d.%d.%d', [FValue.s_b4, FValue.s_b3, FValue.s_b2, FValue.s_b1]);

After this change, The Generated IP list have the IPs still in reverse and byte array is also still in reverse but binarystring and doublewordstrings are correct so IsAddressInNetwork()  function working ok.

May be this information can help the developers to fix the bug.

Thanks for your time

> Hello
>
> If i put the TIdNetworkCalculator (Indy 10.2.3) on the form. In object inspe
> ctor put the NetworkAddress->AsString = 192.168.1.50.
>
> Then Change the NetworkMaskLength from default 32 to 24 and now it show the
> NetWork Mask as 0.255.255.255.
>
> It dont let to set a Network mask of 255.255.255.0, It say "Invalid NetworkM
> ask".
>
> Thanks for your time.
>
> Regards

Replies

None

In response to

TIdNetworkCalculator in Indy 10.2.3 is upside down posted by topmop on Sat, 1 Sep 2007