zuipo
asked on
CREATE URL, HOST NAME WITH INDY 9
CREATE URL, HOST NAME WITH INDY 9
I tried to create My WebPage (http://www.enclarton.com) for somebody who has computer in other home or city with other telefon line through INTERNET. To access to my home page.
I used TIdHostNameServer (EVENTS) and TIdAuthenticationItem (URL) but I don't know how to set them ?
It's only working while I'm putting address in IE6 :
http://127.0.0.1:8080/
But I want that it is working with :
http://www.enclarton.com
With specified INTERNET HOST NAME : www.enclarton.com
Here is how I was trying :
PROJECT1.DPR --------->
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TFo rm1, Form1);
Application.Run;
end.
UNIT1.PAS --------->
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdTCPServer, IdCustomHTTPServer,
IdHTTPServer, IdHostnameServer, IdAuthenticationManager;
type
TForm1 = class(TForm)
IdHTTPServer1: TIdHTTPServer;
procedure FormCreate(Sender: TObject);
procedure IdHTTPServer1CommandGet(AT hread: TIdPeerThread;
ARequestInfo: TIdHTTPRequestInfo;
AResponseInfo: TIdHTTPResponseInfo);
procedure sasaCommandHAddr(Thread: TIdPeerThread; Parm:string);
private
{ Private declarations }
sasaIdHostNameServer: TIdHostNameServer;
sasaIdAuthenticationItem: TIdAuthenticationItem;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.sasaCommandHAddr(Th read: TIdPeerThread; Parm:string);
begin
Parm:='http://www.enclarton.com';
IdHttpServer1.Threads.Add( Thread);
IdHttpServer1.ParseParams: =True;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
sasaidhostnameserver:=TIdH ostNameSer ver.Create (IdHttpSer ver1);
sasaidhostnameserver.Bindi ngs:=IdHTT PServer1.B indings;
sasaidhostnameserver.Defau ltPort:=80 80;
sasaidhostnameserver.OnCom mandHADDR: =sasacomma ndHAddr;
sasaidhostnameserver.Activ e:=True;
sasaIdAuthenticationItem:= TIdAuthent icationIte m.Create(n il);
sasaIdAuthenticationItem.U RL.URI:='http://www.enclarton.com';
sasaIdAuthenticationItem.U RL.Port:=' 8080';
sasaIdAuthenticationItem.U RL.Host:=' 127.0.0.1' ;
end;
procedure TForm1.IdHTTPServer1Comman dGet(AThre ad: TIdPeerThread;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
var
LocalDoc: string;
ByteSent: LongInt;
begin
LocalDoc := 'C:\index.html';
ByteSent := IdHTTPServer1.ServeFile(AT hread, AResponseInfo, LocalDoc);
end;
end.
UNIT1.DFM --------->
object Form1: TForm1
Left = 192
Top = 114
Width = 264
Height = 120
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object IdHTTPServer1: TIdHTTPServer
Bindings = <
item
IP = '127.0.0.1'
Port = 8080
end>
CommandHandlers = <>
DefaultPort = 8080
Greeting.NumericCode = 0
MaxConnectionReply.Numeric Code = 0
ReplyExceptionCode = 0
ReplyTexts = <>
ReplyUnknownCommand.Numeri cCode = 0
AutoStartSession = True
KeepAlive = True
OnCommandGet = IdHTTPServer1CommandGet
Left = 56
Top = 24
end
end
END OF PROJECT1 --------->
THANK YOU.
I tried to create My WebPage (http://www.enclarton.com) for somebody who has computer in other home or city with other telefon line through INTERNET. To access to my home page.
I used TIdHostNameServer (EVENTS) and TIdAuthenticationItem (URL) but I don't know how to set them ?
It's only working while I'm putting address in IE6 :
http://127.0.0.1:8080/
But I want that it is working with :
http://www.enclarton.com
With specified INTERNET HOST NAME : www.enclarton.com
Here is how I was trying :
PROJECT1.DPR --------->
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TFo
Application.Run;
end.
UNIT1.PAS --------->
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdTCPServer, IdCustomHTTPServer,
IdHTTPServer, IdHostnameServer, IdAuthenticationManager;
type
TForm1 = class(TForm)
IdHTTPServer1: TIdHTTPServer;
procedure FormCreate(Sender: TObject);
procedure IdHTTPServer1CommandGet(AT
ARequestInfo: TIdHTTPRequestInfo;
AResponseInfo: TIdHTTPResponseInfo);
procedure sasaCommandHAddr(Thread: TIdPeerThread; Parm:string);
private
{ Private declarations }
sasaIdHostNameServer: TIdHostNameServer;
sasaIdAuthenticationItem: TIdAuthenticationItem;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.sasaCommandHAddr(Th
begin
Parm:='http://www.enclarton.com';
IdHttpServer1.Threads.Add(
IdHttpServer1.ParseParams:
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
sasaidhostnameserver:=TIdH
sasaidhostnameserver.Bindi
sasaidhostnameserver.Defau
sasaidhostnameserver.OnCom
sasaidhostnameserver.Activ
sasaIdAuthenticationItem:=
sasaIdAuthenticationItem.U
sasaIdAuthenticationItem.U
sasaIdAuthenticationItem.U
end;
procedure TForm1.IdHTTPServer1Comman
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
var
LocalDoc: string;
ByteSent: LongInt;
begin
LocalDoc := 'C:\index.html';
ByteSent := IdHTTPServer1.ServeFile(AT
end;
end.
UNIT1.DFM --------->
object Form1: TForm1
Left = 192
Top = 114
Width = 264
Height = 120
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object IdHTTPServer1: TIdHTTPServer
Bindings = <
item
IP = '127.0.0.1'
Port = 8080
end>
CommandHandlers = <>
DefaultPort = 8080
Greeting.NumericCode = 0
MaxConnectionReply.Numeric
ReplyExceptionCode = 0
ReplyTexts = <>
ReplyUnknownCommand.Numeri
AutoStartSession = True
KeepAlive = True
OnCommandGet = IdHTTPServer1CommandGet
Left = 56
Top = 24
end
end
END OF PROJECT1 --------->
THANK YOU.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
the ip and dns don't have anything in common, except that the name (from dns) resolves to an ip address). but otehr than that, they are 2 different things managed by 2 different entities.
let's take a clear example:
- you go to some registrar (godaddy.com for example)
- you buy the domain and they wil host (not proper word) it for you. meaning they give you DNS control and they freely offer 2 of their DNS servers for the domain
- using the DNS control they provide, you change the ip address (the A record) to point to your hosting companies IP address, or your ISP given IP address, provided it's an internet routable IP address (NOT 192.168.x.y or 10.x.y.z or another one. here's more info on private addresses: http://en.wikipedia.org/wiki/Private_network )
after that, when you ping your domain name, it should resolv to that IP adress and respond (if your firewall is not blocking the ping)
that means that your "network" is ready for your application.
THEN, we can go further and see what exactly you want to do. because what I see there makes no sense. if you are using a http server component, you are not using the get command right. you need to think about the http protocol which is implementd by the http server,
you shuld also know that
"TIdHostNameServer implements RFC 953, which is obsolete and no longer in use". instead, the internet uses DNS :)
let's take a clear example:
- you go to some registrar (godaddy.com for example)
- you buy the domain and they wil host (not proper word) it for you. meaning they give you DNS control and they freely offer 2 of their DNS servers for the domain
- using the DNS control they provide, you change the ip address (the A record) to point to your hosting companies IP address, or your ISP given IP address, provided it's an internet routable IP address (NOT 192.168.x.y or 10.x.y.z or another one. here's more info on private addresses: http://en.wikipedia.org/wiki/Private_network )
after that, when you ping your domain name, it should resolv to that IP adress and respond (if your firewall is not blocking the ping)
that means that your "network" is ready for your application.
THEN, we can go further and see what exactly you want to do. because what I see there makes no sense. if you are using a http server component, you are not using the get command right. you need to think about the http protocol which is implementd by the http server,
you shuld also know that
"TIdHostNameServer implements RFC 953, which is obsolete and no longer in use". instead, the internet uses DNS :)
ASKER
I don't know if I'll get IP from DNS (Domain Name Server) or I'll have to use IP form my INTERNET CONNECTION ? After I buy domain enclarton.com and host that domain in DNS ? If I understand it correctly ?
Thank You.