Board index » delphi » Debugge-Exception: Socket Error # 11001?

Debugge-Exception: Socket Error # 11001?


2003-07-31 08:50:58 PM
delphi281
Hi,
this is my first small own created internetprogram:
procedure TForm1.SpeedButton1Click(Sender: TObject);
var HTMLstring : string;
begin
with IdHTTP1 do
begin
host := 'www.pop.com/';
port := 80;
HTMLstring := ConnectAndGetAll;
Try
// still nothing
finally Disconnect;
end;
end;
But it doesn't work. Always appears an (De{*word*81}-)Exception which says:
'Socket Error # 11001.... host not found'
Sometimes the exception also says only: Socket Error # 11004 - with no
further comment.
Where could be the mistake?
Second Question:
If i got this answered HTML-string finally (so i hope anyway *g*), how i can
show the contens like in an explorerwindow. I only have D7Personal and the
Indy-Components to solve this task.
Thanks in advance
asker
 
 

Re:Debugge-Exception: Socket Error # 11001?

"asker" <XXXX@XXXXX.COM>writes
Quote
'Socket Error # 11001.... host not found'
WSAHOST_NOT_FOUND
(11001)
Host not found.
No such host is known. The name is not an official hostname or alias, or it
cannot be found in the database(s) being queried. This error may also be
returned for protocol and service queries, and means the specified name
could not be found in the relevant database.
Quote
with IdHTTP1 do
begin
host := 'www.pop.com/';
port := 80;
HTMLstring := ConnectAndGetAll;
Try
// still nothing
finally Disconnect;
end;
end;
That is not the correct way to request data from an HTTP server. You should
be using the TIdHTTP::Get() method instead:
HTMLstring := IdHTTP1.Get('www.pop.com/');
Quote
But it doesn't work. Always appears an (De{*word*81}-)Exception which says:
'Socket Error # 11001.... host not found'
That is because "www.pop.com" is not a valid host name for a TCP
connection. That is an HTTP URL, a very different issue altogether. The
correct hostname to use would have been "pop.com" instead.
Quote
Sometimes the exception also says only: Socket Error
# 11004 - with no further comment.
WSANO_DATA
(11004)
Valid name, no data record of requested type.
The requested name is valid and was found in the database, but it does not
have the correct associated data being resolved for. The usual example for
this is a hostname ->address translation attempt (using gethostbyname or
WSAAsyncGetHostByName) which uses the DNS (Domain Name Server), and an MX
record is returned but no A record - indicating the host itself exists, but
is not directly reachable.
Gambit
 

Re:Debugge-Exception: Socket Error # 11001?

Thanks for your help,
connecting the host is working now.
Now, my small beginner-program looks like this:
procedure TForm1.SpeedButton1Click(Sender: TObject);
var HTMLstring : string;
begin
with IdHTTP1 do
begin
host := 'pop.com';
Connect;
Try
HTMLstring := Get('pop.com');
// still nothing
end;
end;
But now, after connection there is another problem comes up in form of a
window which appears with the title: Sourcefile not found: IdHTTP.pas And
than it want to have the path for this file. But i don't have such a file. 3
days ago i downloaded Indy9 and such a file wasn't with it. What should i do
now. For what the program want to have this file?
Thanks
asker
 

Re:Debugge-Exception: Socket Error # 11001?

Thanks for your help,
connecting the host is working now.
Now, my small beginner-program looks so:
procedure TForm1.SpeedButton1Click(Sender: TObject);
var HTMLstring : string;
begin
with IdHTTP1 do
begin
host := 'pop.com';
port := 80;
Connect;
Try
HTMLstring := Get('pop.com');
// still nothing
finally Disconnect; // <---- this line IS existing, too
end;
end;
But now, after connection there is another problem comes up in form of a
window which appears with the title: Sourcefile not found: IdHTTP.pas And
than it want to have the path for this file. But i don't have such a file. 3
days ago i downloaded Indy9 and such a file wasn't with it. What should i do
now. Is there any hope for me?
Thanks
asker
 

Re:Debugge-Exception: Socket Error # 11001?

please ignore the last 2 posts. I found this file IdHTTP.pas, of course :-)
But now after i tell this window the path of this IdHTTP.pas - file there
appears another Dubbuger-Exception:
An EIdHTTPProtocolException with the comment: 'HTTP/1.1 400 Bad Request'
Perhaps, do you have any idea to solve this next (small) problem too?
Thx
asker
*g*
 

Re:Debugge-Exception: Socket Error # 11001?

"asker" <XXXX@XXXXX.COM>writes
Quote
An EIdHTTPProtocolException with the comment:
'HTTP/1.1 400 Bad Request'
That is because you are passing the wrong URL to Get(). See my other reply.
Gambit
 

Re:Debugge-Exception: Socket Error # 11001?

Yes, there is no Exception any more and also the string is loaded so there
is only one littel question remaining :-).
Now i also want to show this string like in an explorer-window. Do you know
a (D7Personal-) control or an Indy-Component which is able to do this? (Or
where else perhaps i can download such a component for showing these strings
in his correct way?)
Thanks a lot
asker
 

Re:Debugge-Exception: Socket Error # 11001?

"asker" <XXXX@XXXXX.COM>writes
Quote
i have a little experience in api-functions so perhaps
its possible to realize my intentions about installing the
IE ActiveX control manually.
The IDE has an "Import ActiveX Control" option in its menu.
Gambit
 

Re:Debugge-Exception: Socket Error # 11001?

YES, the WebBrowser is working ! Great !!!
Without your help, i surely would have given up.
So at all events: Thank you very much for this!
...it's a good beginning for more in that direction !!!!
YEEEAAAAAAHHHHHHHHHHHHHHHH *ggg*
(But that will start a little bit later *g*)
asker