Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

GET DIALUP I.P. ADDRESS FROM ISP

Posted on 2000-04-21
9
Medium Priority
?
195 Views
Last Modified: 2010-04-04
Greetings... I would like to ask you guys on how to Get the I.P. Address from an ISP, Ex. I have a dialup account, when I connect to my ISP, definitely A DHCP server will provide me an I.P. address as soon as I get connected.

Examples were given before like the one below:

{Get the IpAddress}
     p2 := iNet_ntoa(PInAddr(p^.h_addr_list^)^);
     WSACleanup;
 edit1.text:=StrPCopy(OutPut,'Hostname: '+Format('%s', [p^.h_Name]));
edit2.text:=StrPCopy(OutPut, 'IPaddress: '+Format('%s',[p2]));


But this gives me the I.P. Address configured for My Lan Card...

Any Ideas? I will just put winsock in the uses section of my source.
0
Comment
Question by:topak
9 Comments
 

Author Comment

by:topak
ID: 2739448
oh I forgot to mention about the snippet that, it gives me correct info about the hostname, but not the I.P. when im connected to an ISP..
0
 

Author Comment

by:topak
ID: 2739450
Just in Case you want 100 points, I have a previous question that is still un answered.. thanks!! {:-)
0
 
LVL 3

Accepted Solution

by:
f15iaf earned 10 total points
ID: 2739852
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,winsock,
  StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    procedure FormClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormClick(Sender: TObject);
var
        cp:pchar;
        m:word;
        n:TWsadata;
        p:dword;
        l:phostent;
        y:pchar;
begin
        p:=30;
        getmem(cp,p);
        m:=MAKEWORD(2,0);
        wsastartup(m,n);
        gethostname(cp,p);
        l:=gethostbyname(cp);
        y:=l.h_addr_list^;
        edit1.text:=inttostr(byte(y[0]))+'.'+inttostr(byte(y[1]))+'.'+inttostr(byte(y[2]))+'.'+inttostr(byte(y[3]));
end;

end.

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 3

Expert Comment

by:bryan7
ID: 2740811
listenning
0
 

Author Comment

by:topak
ID: 2743280
thanks for responding..  but I guess I'll have to work things out with this code im encountering slight problems.. {:-)
0
 
LVL 3

Expert Comment

by:f15iaf
ID: 2743321
what problems
0
 

Author Comment

by:topak
ID: 2743761
others stuffs.. not the ones concerning my queries to you.. {:-)
things here at the office are very chaotic right now.. Its a monday and everybody just got back from a holiday so you know, usual stuffs heheh.. anyway, I was able to test the code you sent me, although It still reflect the I.P. address configured for LAN card.. although I have not tried running the program after connecting to my ISP...
I keep in touch okay? I just have to wiggle my way out of this environment for a while heheheh
0
 

Expert Comment

by:Aleq
ID: 2747608
http://bealsoft.cjb.net/ - TDialUp comonent offers you also IP address ....
0
 

Author Comment

by:topak
ID: 2768204
sorry it took some time... but In fairness I guess i'll give u the points.. sorry if i made u wait... just kinda rough in my office hehe so many work to do..
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

877 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