Solved

GET DIALUP I.P. ADDRESS FROM ISP

Posted on 2000-04-21
9
190 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 5 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

776 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