• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 197
  • Last Modified:

GET DIALUP I.P. ADDRESS FROM ISP

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
topak
Asked:
topak
1 Solution
 
topakAuthor Commented:
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
 
topakAuthor Commented:
Just in Case you want 100 points, I have a previous question that is still un answered.. thanks!! {:-)
0
 
f15iafCommented:
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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
bryan7Commented:
listenning
0
 
topakAuthor Commented:
thanks for responding..  but I guess I'll have to work things out with this code im encountering slight problems.. {:-)
0
 
f15iafCommented:
what problems
0
 
topakAuthor Commented:
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
 
AleqCommented:
http://bealsoft.cjb.net/ - TDialUp comonent offers you also IP address ....
0
 
topakAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now