1. yakov werde
  2. PowerBuilder
  3. Thursday, 2 May 2024 19:09 PM UTC

Hello

Here's an interesting seemingly simple question:

Is the IP address 172.18.13.127 between 172.17.0.0 and 172.19.0.0  ?   (note the comparison values can change)

more generally stated is IP address1 between IP address2 and IP address3

An IP address is a binary number -

how to convert the IP string to a binary and then do a binary comparison in PowerScript?

Thanks

==Yakov

 

 

yakov werde Accepted Answer Pending Moderation
  1. Thursday, 2 May 2024 21:29 PM UTC
  2. PowerBuilder
  3. # 1

Many thanks.

"I could while away the hours
Conferrin' with the flowers,
Consulting with the rain;
And my head I'd be a scratchin'
While my thoughts are busy hatchin'
If I only had a brain.  "

As sung by the scarecrow in the wizard of oz

 

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 2 May 2024 20:37 PM UTC
  2. PowerBuilder
  3. # 2

Hi, Yakov -

If the first of the four numbers of an IPv4 address is considered to be the most significant, and the four numbers are designated as n1, n2, n3 and n4, then converting to an UnsignedLong value is relatively simple:

(((((n1*256)+n2)*256)+n3)*256)+n4

Best regards, John

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.