comp.lang.ada
 help / color / mirror / Atom feed
From: Freejack <user@nospam.net>
Subject: Re: More Florist.
Date: Sun, 02 Nov 2003 17:57:33 GMT
Date: 2003-11-02T17:57:33+00:00	[thread overview]
Message-ID: <pan.2003.11.02.18.03.46.69238.853@nospam.net> (raw)
In-Reply-To: Hz7pb.65795$9E1.276588@attbi_s52

On Sun, 02 Nov 2003 08:23:51 -0500, Jeff C, wrote:



> Have you tried something like
> 
> My_Storage : aliased Database_Array(1 .. 255);
> 
> begin
>  XXX := Get_Network_Info_By_Name(Name =>
>  The_Name_You_Already_Figured_Out,
>                                                               Storage =>
> My_Storage'unchecked_access);
> end;
> 
> ....or something along those lines...
 

Alright...here's what I have so far. Still getting Storage_Error. NetDB
is the only place I get it.(Why isn't there a simple "Get_Host_By_Name"
function? It's the most commonly used NetDB function. Why does one have
to parse the thing out of the response generated from the
"Get_Network_Info_By_Name" function? A design flaw?)
All my other procedures work so far. This is the only one that's
chaffing.

with Posix;
with Posix.Sockets.Internet;
with Ada.Text_IO;
procedure lookout is
	package NetSock renames Posix.Sockets.Internet;
	package TIO renames Ada.Text_IO;
	Response : Netsock.Network_Info;	
	URL : Posix.Posix_String := "www.yahoo.com";
	Address : Posix.Posix_String(1..64);
	My_Storage : aliased NetSock.Database_Array(1..255);
	Len : Positive;
begin

	Netsock.Open_Network_Database_Connection(True);
	Response := NetSock.Get_Network_Info_By_Name(Name => URL, 
				Storage => My_Storage'unrestricted_access);
	Address := NetSock.Get_Name(Response);
	Len := Address'length;
	declare
		Addr : String(1..Len);
	begin
		Addr := Posix.To_String(Address);

		-- Just to see what the hell Get_Network_Info_By_Name --
		-- spits back at me. I have no idea what it'll be.	  --
		TIO.Put_Line("Response was"& Addr &".");
	end;
	NetSock.Close_Network_Database_Connection;
end lookout;

Heh. Let the chuckles begin.

Really though.  Does this code make sense?

Freejack



  parent reply	other threads:[~2003-11-02 17:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-02  4:44 More Florist Freejack
2003-11-02  6:38 ` Patrice Freydiere
2003-11-02 13:23   ` Jeff C,
2003-11-02 14:23     ` Freejack
2003-11-02 17:57     ` Freejack [this message]
2003-11-02 18:25       ` Jeff C,
2003-11-02 19:11         ` Freejack
2003-11-02 23:55         ` David Emery
2003-11-02 22:45 ` Mark Lorenzen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox