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…
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 .

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

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]);
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 =
> Then Change the NetworkMaskLength from default 32 to 24 and now it show the
> NetWork Mask as
> It dont let to set a Network mask of, It say "Invalid NetworkM
> ask".
> Thanks for your time.
> Regards



In response to

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