Solved

GET DIALUP I.P. ADDRESS FROM ISP

Posted on 2000-04-21
9
194 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
[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
 

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
Technology Partners: 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!

 
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

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

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…
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

691 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