?
Solved

increment IP Address

Posted on 2003-02-18
9
Medium Priority
?
420 Views
Last Modified: 2012-05-04
Hi,

i want to increment the IP Address by constant value
e.g

10.10.0.47 + 1 = 10.10.0.48

my approach to say that:
while Edit1.Text < Edit2.Text do
begin
 Host := Edit1.Text + 1;
end;
0
Comment
Question by:aelabed
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 3

Expert Comment

by:gandalf_the_white
ID: 7980223
you can divide the number into 4 parts

W.X.Y.Z

W:=10;
X:=10;
Y:=0;
Z:=47;

then you can add to the number you want any value you want

Edit1.Text := StrToInt(W)+'.'+StrToInt(X)+'.'+StrToInt(Y)+'.'+StrToInt(Z);

0
 

Expert Comment

by:MethinX
ID: 7980542
This way the ip is increased as far as possible :)

W:=10;
X:=10;
Y:=0;
Z:=47;

if Z < 256 then inc(Z)
else if Y < 256 then inc(Y)
else if X < 256 then inc(X)
else if W < 256 then inc(W);

Edit1.Text := StrToInt(W)+'.'+StrToInt(X)+'.'+StrToInt(Y)+'.'+StrToInt(Z);
0
 
LVL 5

Expert Comment

by:Lukasz Lach
ID: 7988647
it should be "< 255", isn't it?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Expert Comment

by:MethinX
ID: 7995921
true 255 is the highest possible, so all less then 256 are possible.

or it should be "<= 255"
0
 

Author Comment

by:aelabed
ID: 7998329
ok, thanx, but first i should to declare w,x,y,z as integer public variables, then i should return tha value to zero after 255 in x,y,z while w < 255 , as follows:

if Z < 255 then inc(Z)
    else if Y < 255 then begin inc(Y); Z := 0; end
    else if X < 255 then begin inc(X); Y := 0; end
    else if W < 255 then begin inc(W); X := 0 end;

    Edit1.Text := IntToStr(W)+'.'+IntToStr(X)+'.'+IntToStr(Y)+'.'+IntToStr(Z);
 
but can I write the IP without points , means i need a text box as that for tha IP address in the tcp/ip properties in the control panel.
0
 
LVL 3

Expert Comment

by:gandalf_the_white
ID: 8007288
you would need 4 editboxes with '.' between them
and set the values in them according to the
values in W,X,Y and Z
0
 

Expert Comment

by:CleanupPing
ID: 9317192
aelabed:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 10

Expert Comment

by:kacor
ID: 9927905
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:
       to accept aelabed's answer
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Some days and here is the Christmas Time. I wish good luck and good health for you all and for your loved ones

kacor
EE Cleanup Volunteer
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 9974890
PAQed, with points refunded (20)

Computer101
E-E Admin
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month7 days, 20 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question